There is not a clear and proven answer to this question. However, there are several options as to why dogs behave thus.
First, the most common and traditional answer to this question is that wild dogs and wolves prepares
to sleep in the long grass, and circling to construct a comfortable place to sleep.
Another explanation says that the dog will verify that there are no hazards such as insects,
snakes and other predators smell. Consequently, dog turn around by 360 degrees to before lying down.
Another answer says that the dog check the wind direction that he able to sleep quietly and he smelt anything that could cause a hazard.
We may accept one or more response versions, however, such behavior actually is derived from the wolves.
Wolf pups as young puppies, sleeping in the pile, but when they grow up they begin to sleep alone,
and also make a circle before lying down. Yes, they show that it is connected to the main animal survival instincts.
So, this is part of the innate instinct and your dog simply must do this.