Dogs evolved from Wolves, if you are looking for even farther back on the evolutionary chain you have to ask what was the evolution of the wolf was. In any case, the dog came from the wolf. Most research states that early people would notice lone wolves hanging out at there fires when they ate. These wolves learned where there were humans there was food. They would pick up scrapes left to them and follow the people around. The people realized this and soon saw that with wolves around the perimeter of the camps they were safer from certian predators including other wolves. So they encouraged the behavoir. Even feeding them more nad more. They started noticing the most tame ones. If these ones bred, they began to take the pups and domesticate them. They would use them as gaurds and sentries, also for work and food. They began to breed traits into the animals that they needed. This in turn changed the Size, the Shape, The Color, The bone structure. Eventually and quickly many breeds of diffrent dogs were created, just by human manipulation.
ADDITIONAL INFO: Remember you asked for the evolution of the dog, the dog evolved from the Wolf, the Wolf evolved from the Micads, a gopher like carnivore, Miacids evolved from Creatous insectavore. Direct decendents of Miacids are todays Genets of Africa. Wolves are a sub-species of Miacids. Those are earliest know wolve ancestors. The first actual recorded fossil of an actual canid wolf is is Cynodictis or otherwise dubbed the Dawn Wolf. They are said to look more Fox-like and were able to climb trees, most of there prey was small animals. Hesperocyoninae is a sub species of Cynodictis Canid. They were more doggy in appearance but were wolve cousins. Borophagines were a pack hunting off shoot of Cynodictis Canid, a Hypercarnivore, mostly they were scavangers and omnivores where they ate anything, they had low slung bodies, had very large heads and jaws, powerful chests, small hindquarters, and they gave rise to mostly the Hyena families.
i thought this was interesting and i thought id share
i love this kind of stuff!