Many believe it's instinctual behavior, harkening back to the days when your dog's wild ancestors would mask their scent to help them sneak up on their prey.
Wolves, for example, have been observed rolling in animal carcasses or the droppings of plant-eating animals, to cover up their own smell during the hunt.