"It is thought that cats were originally domesticated because they
hunted mice that would eat stored grains, but a recent study found that
cats domesticated themselves. They were never specifically sought out
for domestication like dogs were but their coexistence with humans
naturally developed from the mutually beneficial nature of the
relationship, with their hunting protecting the food stores. It was a
beneficial situation for both species: cats got a reliable source of
prey, and humans got effortless pest control. This mutually beneficial
arrangement began the relationship between cats and humans which
continues to this day."
Learn more on wikipedia