Your dog has an instinctive urge to scratch his bed, thanks to his ancestral drive to dig beds in the wild to get warmer or keep cool. He also has sweat glands on his paws that provide a form of marking when he scratches -- a preferable alternative to urine marking while still declaring that bed as his own. He may not be digging a hole outside like his ancestors, but his scratching, often accompanied by circling, is also his way of just getting comfortable.
Why Do Dogs Scratch Their Beds Before Laying Down?
The Instinctive Urge
Wild dogs and their wolf ancestors dug shallow beds to regulate their temperature, mark their territories and protect their young. They also gathered and hid their food in this holes. Providing your dog with the finest, most comfortable dog bed will not always offset this instinctive urge, which may range from violent scratching to walking around in circles. Circular pacing would serve to tame tall grasses that might hinder his bed-making progress -- as well as root out snakes and other critters that don't make good nighttime companions. Another possible advantage to flattening grass was that it was a visible sign to other dogs that a particular spot was now occupied.