When you have had a chance to think about this, expand the item below for some background regarding the domestication of dogs – which is pretty much what we're looking at, even though I didn't explicitly use the word domestication!
Whence dogs?
The key process at play here is something called artificial selection, a process humans facilitate through selective breeding. Here is a definition for you:
The practice of selecting animals for breeding on the basis of phenotypic characteristics such as their appearance, performance, or production records. This is common in breeding dogs (Caninae) for showing, horses (Equidae) for racing, and farm animals for milk or meat production. Source
Using this process allows humans to control phenotypic development. To domesticate dogs, you might chose to select for:
- Tameness (i.e. breed those individuals which are least afraid of humans)
- Smaller size
- Other physical traits such as smaller jaws, diminished craniofacial development
Here is what we actually know of this:
- The genetic divergence between dogs and wolves began between 40,000–20,000 years ago
- Thre are competing theories to how domestication may have occurred
- Humans may have captured wolf pups for use in guarding or hunting, resulting in selection for traits of importance for these new roles
- Alternatively, as humans changed from a nomadic to sedentary lifestyle during the dawn of the agricultural revolution, wolves may themselves have been attracted to dumps near early human settlements to scavenge
- This is quite an active area of research, and new ideas are coming out all the time. (And of course, some of this assumes you believe Chihuahuas are tame – I understand some people believe they're not that chill).
Bonus info: Domestication syndrome
More broadly, looking at domesticated animals, we can identify a suite of behavioral, physiological, and morphological traits that are associated with domestication. This is referred to as domestication syndrome.
It includes (but is not limited to) docility and tameness, changes in coat colour, reduced tooth size, changes in craniofacial morphology, and alterations in the form of ears and tails form. In addition to these morphological traits, it is also associated with changes to the reproductive cycles and hormones of the animals, shifts in the concentration of a number of neurotransmitters, a longer period of juvenile behavior, and reductions in total brain size, and also of specific brain regions.
Recent research suggests that these may all be linked, and current work is exploring the mechanisms that might underlie this – these could, for example, be developmental.
If you want to read more, this paper is a good place to start: Wilkins, A.S., Wrangham, R.W. and Fitch, W.T., 2014. The “domestication syndrome” in mammals: a unified explanation based on neural crest cell behavior and genetics. Genetics, 197(3), pp.795-808.