It doesn’t. (Just like monkeypox doesn’t come from monkeys.)
Cowpox is a viral infection and the natural reservoirs are actually rodents. Humans, cats and cows are amongst the more common "accidental hosts" – species that get infected sporadically but are not reservoirs. Contact with an infected rodent can result in transmission of cowpox to people. The virus can also come from an animal that gets cowpox from a rodent and then passes it on to a person, as a Dutch teenager found out…
A 17-year-old girl found a kitten in the ditch and picked it up. It was sick and ultimately died (probably not from cowpox). She later developed a skin lesion on her wrist, which progressed to red lumps over her arm. Not surprisingly, cowpox didn’t jump to mind when she saw her doctor, so it took a while before a diagnosis was made, but they figured it out eventually. Since cowpox infection is usually self-limiting in individuals with a normal immune system, the girl eventually got better without any specific treatment. It took a couple months, though, and left a scar.
Presumably the girl got cowpox from the kitten, which probably got cowpox from contact with an infected rodent. This is an unusual series of events, certainly, but far from unprecedented. Cats are one of the main non-reservoir species that are implicated in cowpox transmission to people, presumably because they get infected while hunting wildlife (e.g. rodents). Cowpox is a pretty rare infection in people and usually not very severe, so it’s nothing to be paranoid about, but it’s another reason to use good hygiene practices and keep cats from going outside and hunting.
FYI Cowpox got its name because infected cows often develop lesions on their udders, and it was a common infection of dairymaids in times when cows were milked by hand. This virus also features prominently in the development of the world’s first vaccine in the late 1700s, as the cowpox virus itself was used as a vaccine against the deadly smallpox virus.