If you have a
dog you may notice that if they find something
really foul smelling they'll probably start rolling around in it. Why do they do this? Well, the most widely
agreed upon explanation is that the dog is covering up his or her own scent. Even though dogs have co-evolved with
humans for thousands of years, they still have certain natural
instincts.
If you take a look at wolves, they do the same thing. They'll roll around in decaying carcasses, feces from herbivores, and other nasty smelling things that are natural in the wild. This masks the their own scent so they can hunt their prey with much more ease. If, let's say a deer, is standing there munching on some vegetation, it's going to be smelling the air with its powerful nose to alert it if anything that wants to eat it is around. Now, if the predator smells like a rotting carcass, or like deer poop, that predator is going to be able to sneak up on the deer much better. This ensures a higher chance of making the hunt a success, thus raising the chance of its survival.
Even though your dog isn't hunting things, he or she will still have the urge to cover itself in some kind of stinkiness. Next time your dog gets out of the bath you just gave him, you can see this, as he'll go right away to start rolling on various things.