From Smithsonian Magazine:
When humans were predominantly hunters, dogs were of great use, and thus were domesticated long before cats. Cats, on the other hand, only became useful to people when we began to settle down, till the earth and—crucially—store surplus crops. With grain stores came mice, and when the first wild cats wandered into town, the stage was set for what the Science study authors call “one of the more successful ‘biological experiments’ ever undertaken.” The cats were delighted by the abundance of prey in the storehouses; people were delighted by the pest control.
“We think what happened is that the cats sort of domesticated themselves,” Carlos Driscoll, one of the study authors, told the Washington Post.
That sounds about right.