I saw a documentary once about how dogs and cats were domesticated. Their wild ancestors gravitated toward human settlements for food, since humans store food and are also quite wasteful.
It's commonly assumed that the members of local wolf packs, who were somewhat lazier and braver than their pack-mates, were attracted by the middens (a fancy word for "garbage piles") near human settlements. Although wolves are hunters, they are also opportunistic scavengers who will eat the leftovers of other carnivores' kills, particularly the intestines and their contents because their own digestive tracts are too short to maintain a healthy bacterial culture. A pile of decaying food, full of health-giving bacteria, would have seemed like a gift to them. They soon discovered that as long as they didn't attack the humans, we seemed to appreciate their janitorial work and let them stay. As the two species crept closer to each other, the wolves' night vision made our nights safer... which greatly lengthened our periods of REM sleep, giving us more time to catalog the days events from the forebrain to the midbrain, inadvertently making us SMARTER! The more gregarious wolves welcomed this partnership and were happy to join our hunting parties: six legs are better than two, and human heads are high enough to see farther into the distance.
Eventually the domesticated wolves' brains grew smaller, adapting to a diet lower in protein but higher in carbohydrates. Their instincts also evolved, becoming less "alpha" and allowing members of another species to lead the pack. They also developed
neoteny, the retention of early traits into adulthood, such as barking, wagging their tails and roughhousing, which endeared them to the human children and, eventually, the adults.
As for cats, everything I've seen on the subject insists (from their DNA) that they were attracted to the granaries in Egypt, which were plagued with rodents. The humans were utterly delighted with this, and left out bowls of milk for them to use when the rodent population was in check. Neoteny figured in this relationship too: cats raised among humans allow us to pick them up and groom them, sensations they remember from kittenhood. They have even become gregarious, a trait that is rare in wild cats. All domestic cats are of the subspecies
Felis sylvestris lybica, the African population.
Although wolves lived on every continent except Australia and Antarctica, all living dogs are descended from a pack in Mesopotamia, where the first of their subspecies
(Canis lupus familiaris) first arose. Both domestic dogs and domestic cats were traded by adventurous humans who already had them, before people in other parts of the world domesticated their own neighboring wolf pack or the cats in their own granaries.
What I wonder is: How did anybody decide to ride a horse? Or milk a cow?
Humans realized that all baby mammals drink milk. Many calves died in the Neolithic era, leaving many nursing cows with distended udders. Surely someone decided to experiment with harvesting that milk for his own babies, making life easier for their mothers. As milking became more common, babies were allowed to drink it much longer, and eventually mutations allowed their bodies to continue to produce lactase, the enzyme needed to digest lactose. In the dairy-intensive civilizations such as India and northern Europe, pretty much everyone is lactose-tolerant. Since dairy farming is ten-times as efficient a use of pasture land as beef farming, dairy-farming civilizations had a tremendous advantage.
As for riding a horse, they started with goats or donkeys and trained them to pull carts. As oxen and other larger animals were domesticated, surely somebody watched a horse pulling a wagon and thought, "That load is really slowing him down. I bet I could climb up on him without being thrown off."
I want to know who was the first person to imagine riding an elephant!