I learned that certain melachos are permissible on Shabbos in the course of eating or for the purposes of eating. For example, the question of borer in light of "derech achilah"/"derech melacha" is discussed here. It seems that certain permissible forms of food preparation, such as making a salad, are also permitted for this reason. (If not--if these were permitted because there is no melacha involved--I would wonder why some stipulate that the salad needs to be made shortly before eating. And, more generally, it seems clear that some of these permitted forms of food preparation, such as peeling vegetables, do involve what would otherwise be considered a melacha.)
If this is the case, and if we are in fact more lenient on many melachos because of derech achila, then why wouldn't cooking on Shabbos be allowed for the same reason? Although it is obvious enough that cooking is stringently prohibited on Shabbos, a secular Jew recently asked me this question, and I didn't know how to answer.