It's a primitive instinct that makes them feel comforted and secure.
In the wild, dogs would walk around on the grass, snow, or underbrush to pat it down and create a smooth area to lie on. Walking in circles would have also scared off any smaller animals, like snakes, that might have been in the area. At home, your pooch doesn't have to worry about predators, but circling still helps give him a sweet stop to crash. You may even see them scratch at a rug or bedding before circling, to fluff it up and make it even softer for sleeping.