The history of modern human development is arguably best measured by domestication - agriculture and pastoralism laid the groundwork for the most profound alterations in societal structure humans have experienced. The reason dogs are so unique is not just that they were the first species domesticated, but that they hold the record by a factor of about two - dogs were domesticated 15,000 to 20,000 years ago, but the first domesticated cereal grains don't appear until 9,000 years ago. People didn't know how to domesticate animals yet or even have a concept of living in partnership with other species. In fact, dogs sorta domesticated us.
The megafaunal wolf was a great candidate for domestication. Wolves have complex, hierarchical social structures which allowed for humans to peaceably dominate. They are very intelligent and naturally cooperative, with flexible diets and a manageable size. Maybe most importantly, they shared the ecological niche of megafauna hunter with the new, tool-wielding kids on the block, and faced extinction unless they learned to get along.
The first canines to take an interest in humans were probably submissive males, who had less access to prey and reacted less strongly to nearby humans, hanging around kill sites to strip carcasses left by hunters. More docile and cooperative individuals might be allowed closer to camp, and even be favored by humans because of their ability to deter other animals, and after thousands of years we humans caught on to the fact that we had domesticated something, whatever that meant...
It's tough to determine the exact place or time of dog domestication. Archaeological evidence is difficult to rely on because physical characteristics are poorly correlated with domestic behavior, and genetic evidence is never conclusive since millennia of interbreeding with wild wolf populations has erased genetic records and rendered domestic dogs as diverse as their untamed cousins.
Grey wolves and domestic dogs are in fact regarded as breedable subspecies of the same species, with the characteristic dog temperament relying on the flipping of just 11 genetic loci, regulatory genes with cascading effects ranging from reducing ear cartilage, shrinking the snout, and surprisingly greatly reducing the size of the brain, especially the limbic system, responsible for aggressiveness and stress responses. These differences, of course, are what separate dangerous wild animals from man's best friend, who we've taken everywhere from the Artic circle to the Polynesian islands and incorporated into our lives as hunters, shepherds, guards, and companions.
nitty gritty genetics mostly paywalled :(
Belyaev's famous Russian fox experiment