The Domestic Cat developed as a new species around 5000 years ago when some of the tribes of North Africa gave up their nomadic existence and settled on fertile land to farm.
The excess grain they stored attracted mice which in turn attracted the African Wild Cats who hunted small prey. The easy prey suited the wild cats and as the farmers saw their stores protected they encouraged the cats.
To become a domestic cat, however, the wild cats had to move into people’s homes. Unlike many small cat species African Wild Cat kittens can develop a certain level of tameness if raised with people from a young enough age. Kittens found by humans and brought into the home would have become friendly and over the years a sort of natural selection would have taken place as the friendliest and most human oriented ones would have benefited most from the shelter and protection of human homes.