In approximately 12000 BCE, the grey wolf was domesticated into the "Canis familiaris" (latin term for domesticated dog) by nomadic people who lived a hunter-gatherer lifestyle.
This domestication happened before the domestication of sheep, cows, goats, and many other farm animals.
Domestication is when one species has large influence over another in ways such as controlling reproduction and care. There are many theories on why this initially happened, but one is that wolves ate people's food scraps, and gave indirect protection by killing nearby predators. Then they were more likely to live if they were tamer to people, leading to their initial domestication.
After this initial domestication of the Grey Wolf, they were split into many different breeds. In fact, there are more dog breeds than breeds of any other animal. But why? This split happened because they dogs were wanted/needed for many different reasons.
A dog is different from a wolf in many ways. One is that it is domesticated to be friendlier to people, less aggressive, and to be more playful. Also, docile dogs have less stiff ears, and dogs have smaller craniums than a wolf of the same weight.
Domesticated dogs have a changed diet, and are able to eat starch and other human-foods because of a genetic change (in Alpha-Amylase 2B) which allows them to digest it. This is speculated to have happened because early dogs would have been able to exploit eating crops of early human agriculture.