When the euthanasia comes from animal control, it's because a dog can neither be placed with people within a reasonable amount of time nor can it be allowed to roam free.
Finally, of course, people put down their old and sick dogs rather than force their animals to endure a slow and painful death.