What is the reason that we can do melachot for preparing food on Yom tov but all other melachot are forbidden like on Shabbat?
Shmot (Ex) 12:16 - "No manner of work shall be done in them, except that which every man must eat, that only may be done of you." that is the source of the statement that allows food preparation on Yom Tov.
As for WHY the Torah was more lenient on Yom Tov than on Shabbat, esp. with regard to food preparations, I'm surmising on this. Two ideas - 1) On Shabbat God rested from all work, so we "imitate" God. There is a concept of COMPLETE rest on Shabbat, no such concept (at least as mentioned in the Torah) of resting is stated for Yom Tov.
2) Yom Tov has a concept of "simcha" - joy, which Shabbat doesn't. An integral part of "simcha" as defined in the Talmud and other sources is food and drink. Yes, it is a mitzvah to eat on Shabbat as well, but there's a different derivation for that. In either case, to accomplish the simcha with food, it has to be prepared. The Talmud in various locations, discusses the concern from fresh food specifically on Yom Tov, and allows leniencies on preparing food on Yom Tov itself in certain cases even if, technically, the food could have been prepared before Yom Tov. That's how important "simcha" and food are considered on Yom Tov. You don't see these leniencies for Shabbat.