I have often had people ask me why their otherwise, apparently sane, dog, will roll around in garbage or dung or something equally offensive in its smell to humans. One man even told me that he has stopped walking his dog along the shore line because whenever a dead fish, or a mass of seaweed containing rotting organic matter washes up on shore, his dog makes a direct beeline to that smelly mess and immediately begins to roll in it. The dog would usually walk away with a stench that required it to bathed or at least hosed down before it could be allowed in the house afterward.
There are several theories which have been used to explain why dogs like coat themselves with distasteful strong odors. One of the silliest of these theories is that this is a means of fighting parasites. The notion is that insects, such as lice and fleas, wouldn’t hang around on something which smelled that bad. Unfortunately, most insects do not seem the least bit put off by bad odors on a dog, and, in fact, many insects are attracted to such smells because it usually means that there is decomposing organic matter there.
A second theory claims that this is sort of a means of writing a message to the other members of the pack. A dog or a wolf seems to like rolling around in things which smell bad, however if you take an inventory of what they are choosing to anoint themselves with you will find that it is always organic, such as dung, rotting carrion and so forth. Since the wild ancestors of dogs were not only hunters but also scavengers, much of the stuff that they are rolling in could still possibly be edible. The notion then is that the wild canine rolls in this material and then returns to the pack. The other members of his group immediately pick up this scent and know that there is something which can pass for food nearby. However if such were the case, one would expect that when a wild canine arrives back at the pack with his new odorant, the pack members should immediately start backtracking toward the site where their pack mate came from. This is certainly not the usual case.
A third theory suggests that the dog is not trying to pick up odors from the stinking mess it rolls in, but is actually trying to cover that smell with their own scent. It is certainly true that dogs and wolves will often roll around on something, like a stick, a new dog bed or such, as if they were trying to deposit their scent on it. Some psychologists have suggested that dogs often rub against people to leave a trace of their scent and to mark the individual as a member of the pack, much the way that cats rub up against people to mark them with their odors.
The explanation which makes the best evolutionary and adaptive sense is that this stinky behavior might be an attempt at disguising the dog. The suggestion is that we are looking at a leftover behavior from when our domestic dogs were still wild and had to hunt for a living. If an antelope smelled the scent of a wild dog, or jackal or wolf nearby, it would be likely to bolt and run for safety. For this reason wild canines learned to roll in antelope dung or carrion. Antelopes are quite used to the smell of their own droppings and carrion is common on open plains where many animals live. That means that the antelopes or other prey animals are less likely to be frightened or suspicious of a hairy thing that is coated with that smell rather than that same visitor who smells like a wolf. This allows the wild hunting canine to get much closer to its prey.
I have another theory, however, which is of no scientific merit whatsoever. For human beings our dominant sense is vision while for dogs it is their sense of smell. Dogs, like people, enjoy sensory stimulation and may well be prone to seeking such stimulation to an excessive degree. Therefore, I believe that the real reason that canines roll in obnoxious smelling organic manner is simply an expression of the same misbegotten sense of aesthetics that causes human beings to wear overly loud and colorful Hawaiian shirts.