It is not a need to survive. Things that can survive and hunt better can have more offspring than their rivals who don't hunt as well. The population of the species is eventually dominated by offspring of the better survivors. A few generations later, the same species is a better survivor than its ancestors.
As for cooking: it breaks down the food and releases nutrients not available in raw form. Humans cannot digest cellulose, which is what plant material is. Cooking it disrupts the cells, releasing all that nutritive goodness. That means they have better nutrition, better health, better survival, more offspring. They can outcompete rivals, (such as, say, Neanderthal).