The Yomim Tovim celebrate monumental events in Jewish history. The focus of these days is on bringing Jews together as a people and as friends. Shabbat, on the other hand, is first and foremost focused on recognizing G-d as the Creator of the universe. This differing focus may help explain why cooking is allowed on Yom Tov but not on Shabbat. There is no better way to bring people together than through food. With Yom Tov's focus on community building, eating together is paramount; and in order to have the best of foods, cooking is permitted. While we are commanded to eat on Shabbat, here the focus is heavenly, and we must prepare all food beforehand[1].
While cooking is allowed on Yom Tov, such may only be done if the food is needed for Yom Tov itself. One may not use the day off from work to cook for guests coming over the following week. And while on a Biblical level, one may, the Gemara notes, cook from Yom Tov for Shabbat, the rabbis forbade such unless one makes an eiruv tavshilin, where one begins the cooking process for Shabbat before Yom Tov begins. By doing so, the rabbis were hoping to emphasize the prohibition of cooking for a weekday on Yom Tov.
As part of the Temple service, each Shabbat twelve loaves of bread, the lechem hapanim, were distributed - six (according to some seven) to the mishmar, the group of kohanim who were starting their weekly cycle of Temple service, and six (according to some five) to the outgoingmishmar of kohanim. This bread would normally be cooked on the Friday before, i.e., eight days before it was to be distributed - and the freshness of the bread is among the miracles that occurred in the Temple. However, if Friday was a Yom Tov, the bread would be cooked on Thursday; and if Rosh Hashana fell on Thursday and Friday, then the food would be cooked on Wednesday, ten days prior to distribution. The fact that the baking would have to be done prior to Yom Tov would seem to indicate that biblically one may not cook on Yom Tov, even for Shabbat.
What interests me more than the answer to this question[2] is a problem noted by Rashi and Tosafot. If Rosh Hashana falls--as it does this year--on a Thursday and Friday, how can the Talmud say the lechem hapanimwould be eaten ten days later on the following Shabbat? That day is Yom Kippur!
I would like to focus on the second answer to this problem proposed by Rashi. We all know that a Jewish day starts in the evening prior. What is less well known is that this is not universally true. In the Beit Hamikdash, the day starts in the morning and ends the next morning. The night marks, not the beginning, but the end of the day. Hence, when a sacrifice is brought, it can be generally be eaten until the end of that day; i.e., the following morning. So when Rosh Hashana falls on a Thursday, the lechem hapanim is baked on the Wednesday and is eaten ten days later - on Saturday night - after Yom Kippur has ended, but before daybreak.
It is this dual system that makes the seder night so special. A careful but rather obvious reading of the biblical text (see Vayikra 23:4) reveals that the holiday of Pesach is observed on the 14th of Nissan. It is celebrated by bringing the pascal lamb as a sacrifice, to be eaten later that night - towards the end of the Temple day. It is chag hamatzot that begins in the evening, on the 15th of Nissan. The seder night thus marks the overlap of chag hapesachand chag hamatzot. It is when we are to eat both the pascal lamb and the matzah--together, no less.
Rav Shimshon Raphael Hirsch beautifully explains that the Temple as the resting place of the divine presence is associated with light. The day begins (and ends) at daybreak. But for the rest of the world, where it is much more difficult to feel the presence of G-d, the day begins (and ends) in darkness. It is the light of Torah that guides us, helping to illuminate the darkness that surrounds us.
[1] I seem to recall seeing an explanation along these lines in the Meshech Chochmah, but in looking it up for this article, I could not find it. It is quite possible my memory is faulty - in any event, I find the explanation interesting.
[2] The Gemara (as understood by Rabbeinu Chananel) explains that, while normally one can cook on Yom Tov for Shabbat, this is only for the upcoming Shabbat, but not for the following week.