SO – why did hominids get brainy?
Two reinforcing factors.
First, before brains were very big, some hominid ancestor learned to cook food over whatever fire there was; lightning strikes, that sort of thing. That food was more easily digested, so getting more nutrients was simple. After that, maintaining fire paid off. The access to better food meant a metabolic boost, one effect of which was to reduce the relative cost of a bigger brain.
Second, over the past two million years the area in northern Africa where hominids were prominent underwent a series of about ten violent weather changes. New predators, new prey, different food plants, different strategies for staying safe and well fed, different strategies for surviving the annual period where food was hard to find. Ten of these, about every 200 thousand years. Each one favored cleverness and mental flexibility. Since brains weren’t as expensive as before, they could grow. So they did.
The above is a layman’s recollection from reading and reflecting. The real reason, though, that homo sapiens managed to grow a bigger brain was that it *could*.