Dogs are descended from wolves. The first domesticated dogs were likely wolves.
There are several reasons it would make more sense to domesticate wolves than foxes.
Wolves generally hunt in packs, foxes generally hunt solo
Early humans would have seen the social behavior and realized the pack was similar to their own tribe. It wouldn't be too long before a human decided to take some wolf pups and see if he could integrate them.
Wolves are bigger than foxes
Wolves tend to be larger than foxes and are higher on the food chain. You don't want your dog getting picked off by predators. Both in time invested and emotional attachment losing a trained animal is a big deal, so early humans would pick something reasonably high on the food chain to lessen the chance.
NOTE: There are larger predators such as tigers, but they are more difficult to train, and one mistake will likely lead to life-long injury or death.
Selective Breeding
Domesticated wolf pups would have been selectively bred to be loyal, strong, and obedient. The most violent wolf pups would be put down, and other undesirable traits would be bred out, and desirable traits would be amplified. After a few generations, the new dogs from these pedigrees would be much more valuable than even a new litter of undomesticated wolf-pups due to specialization. There would be no reason to start from 0 with a fox when you have bred dogs capable of producing litters of puppies for you.
EDIT:
Hunting in packs allowed wolves to bring down larger animals
A commenter pointed out that a fox would require less food, which in lean times would be a big advantage. The foxes instinct to hunt alone is its Achilles heel. Foxes must focus on smaller prey due to their solitary hunting.
Wolves, on the other hand, can bring down larger prey such as deer because they are part of a pack. Early humans would have needed larger game as a source of protein. Dogs, descended from wolves, already know how to hunt large game. A fox would have to be trained to do so.
EDIT 2:
Fox v Cat
Since foxes hunt rats, it might be logical to domesticate it for rat killing to protect stored foods such as grains. Cats have an advantage here. Their small size means they eat less, and probably won't attack your domesticated chickens. They also like killing rats. The saying is There is a fox in the hen house, not a cat.
NOTE: In modern times, some dogs such as Chihuahuas are prized because of their small size and acuity to living indoors. The breed was recognized in 1903.