The best scientists in the world don’t know for sure when dogs were first domesticated (or where). I think the question is incorrectly formulated. It should be when were gray wolves first domesticated? But I’m being pedantic. The bigger issue is when and where it happened and the scientists are in dispute about this so you won’t get a nice clear cut, black-and-white answer.
I’m going to rely upon the Smithsonian magazine if I may. They say that grey wolves and dogs diverged as different species from about 15,000 to 40,000 years ago. The scientists in general agree with this. We don’t even know where it happened and here’s another thing: the domestication of the grey wolf may have happened more than once and in different places in parallel.
People might assume that the domestication of the grey wolf occurred at one single point at one time in the history of the planet. But perhaps a more commonsense viewpoint is that it occurred in various places at various times because 20,000 years ago humans did not travel vast distances as they do today on a regular basis and therefore there was no opportunity for a domestic dog to be transported to a new place where they could be bred to establish domestic dogs in that place.
In the summer of 2019, a study reported in Nature Communications suggested that the date of domestication might be closer to 40,000 years ago and at least 20,000 years ago. The scientists sampled DNA from two Neolithic German dog fossils which were 4,700 years old and 7,000 hundred years old. This research yielded these new dates.
This study also suggests that it was likely that there was one single grey wolf domestication event. Another study suggested that dogs were domesticated in at least 14,000 years ago and that their lineages split into East Asian and Western Eurasian dogs about 14,000 to 6,400 years ago.
Because fossils have been found in different places i.e. the regions mentioned above and in Europe researchers have suggested that wolves may be domesticated twice. They also suggest that the European branch of domesticated dog did not survive to the present day.
Researchers also suggest that DNA analysis is difficult because of crossbreeding between domesticated dogs and wolves over the many thousands of years of domestication. In another Smithsonian magazine article the authors said that guard dogs employed to protect sheep are mating with wolves instead. It’s a case of gamekeepers turning poachers! And it further muddies the water in trying to understand when dogs where first domesticated.
One thing which is fairly clear is that dogs were domesticated before cats: about 9,500 years ago but even this is subject to revision by scientistists in the future.
SOME MORE ON THE WOLF: