Digging is a natural instinct for dogs (albeit a pretty annoying one). Your dog may be digging because he wants to find a cooler spot to lie in. A lot of dogs dig because they want to bury something of value, like a bone of their toy. This instinct to hide things comes from their ancestors who would conceal food so they could come back to it and eat it.
A dog digging a hole in the garden
Some dogs dig purely for entertainment, this is very common in terriers who have been bred to dig. Giving your dog their own sandpit to dig in will prevent them digging up your precious flower borders.