כִּי בַסֻּכּוֹת הוֹשַׁבְתִּי אֶת-בְּנֵי יִשְׂרָאֵל
The mitsvah to dwell in sukkot for seven days comes Vayikra 23:42, part of the greater description of the holiday of Sukkot in verses 33-43, probably the largest description of Sukkot in the Torah. It’s also the only such description that includes a reason for the mitsvah to dwell in sukkot. “In order that your generations will know that I caused Bnei Yisrael to dwell in sukkot when I brought them out of the Land of Egypt. I am the Lord your God” (Vayikra 23:43). Bnei Yisrael are commanded to dwell in sukkot in order to mimic and recreate the experience of Bnei Yisrael in the wilderness. This experience that is characterized mainly by two trends, Bnei Yisrael complaining about not suffering due to their not being in Egypt any more, and ‘א providing Bnei Yisrael with sustenance throughout their journeys in the wilderness.
Throughout their travels in the wilderness, Bnei Yisrael repeatedly complain that they wish they could return to Egypt, or that things were better in Egypt. The first time is just after the splitting of the sea. “If only we had died by the hand of ‘א in the land of Egypt, when we sat by the flesh-pots, when we ate bread to satiation; for you have brought us forth into this wilderness, to kill this whole assembly through starvation” (Shemot 16:3). This is the first of many times such a complaint occurs due to a lack of food or water. A totally different motivation for such a complaint appears in Bamidbar 16, in the rebellion of Dathan and Aviram. “is it a small thing that thou hast brought us up out of a land flowing with milk and honey, to kill us in the wilderness, but thou must needs make thyself also a prince over us?” (Bamidbar 16:13). This complaint is not about a lack of food, but about Moshe being unsuitable as a leader. They go so far as to call Egypt “a land flowing with milk and honey,” a phrase otherwise only used to refer to the Land of Israel. Seeing as their experience in Egypt was one of crushing labor and abject slavery, it is difficult to understand why they would desire so strongly to go back to it. However, this becomes a little clearer when understood in light of the post-modern concept of a narrative.
The word “narrative” refers to a story, but in the post-modern sense it refers more particularly to the stories by which people define their lives. These stories give a context within which the events and occurrences of their lives can be understood. It gives people a framework within which to choose what course of action they should pursue. The historical perspective of Tanakh, from the beginning of Creation in Sefer Bereishit to the messianic visions of the prophets, is a narrative within which Bnei Yisrael understand the meaning of the events that happen to them. This is perhaps the greatest function of the prophets, telling Bnei Yisrael that the major events they undergo, such as the destruction of the Bet HaMikdash, are not random event, but are part of a larger story and make sense when viewed as such. One of the most notable effects of the loss of prophecy has been a disconnect from Tanakh’s historical narrative. Without a prophet, Bnei Yisrael had no way of knowing with certainty the significance of any occurrence, but can only try and fit it into the context of Tanakh’s historical vision.
Returning to Bnei Yisrael in the wilderness, their complaints about no longer being in Egypt can be understood in terms of a loss of narrative. In Egypt, they knew what story they were participating in, even if it was an unpleasant one. They knew who was in charge and why, they knew where their food and water came from, and they knew what they were supposed to do when. Then ‘א took them out of Egypt, and they knew none of those things. When they didn’t have food, they complained that they once knew where their food came from, and when they felt they had been lead badly, they challenged the source of the authority of their leader. They had lost their Egypt-Narrative and until they would enter the Land of Israel, they were a little lost.
The second typifier of Bnei Yisrael’s wilderness experience was that they were totally sustained by ‘א. When they needed food, he gave them Manna (Shemot 16:4-5) and Quail (Shemot 16:12-15). Their leadership was sent by ‘א, and when they doubted this, they were reminded via miracles (Bamidbar 16:28; 17:16-26). Their garments were miraculously sustained by ‘א, neither wearing out nor being outgrown (Devarim 8:4). Even their living-spaces were given to them by ‘א (Vayikra 23:43). Bnei Yisrael’s entire wilderness experience was defined by the way they lived their lives cradled in the hand of ‘א.
On sukkot Bnei Yisrael were thrust out of our normal, everyday, narratives and pushed into the wilderness. Every year, as they were gathering in their harvest (Vayikra 23:39; Devarim 16:13), Bnei Yisrael were reminded that they do not survive by their produce alone, but by the word of ‘א (Devarim 8:3). Sukkot is a week where we step out of our normal stories, our routines and procedures, and remember the truth that these stories obscure, that we are not independent, that our stories are conditional and dependent, that the lives we build were built with the power that ‘א gives us (Devarim 8:17-18).
 Jean-François Lyotard, The Postmodern Condition.
 While they received the Torah long before they entered the Land of Israel, many if not most of the mitsvot apply only when in the Land of Israel (never mind the opinion of Ramban that the mitsvot only apply inside the Land of Israel). Receiving the Torah did help Bnei Yisrael’s mindset somewhat, but that is part of a different discussion.
 The exact nature of the “sukkot” that ‘א caused Bnei Yisrael to dwell in is subject to Rabbinic debate, with R’ Eliezer understanding them as booths such as Bnei Yisrael build today, and with R’ Akiva understanding them as the Clouds of Glory. For an excellent discussion of how R’ Akiva’s view fits with peshat, and of the symbolism behind both views, see this essay by R’ Prof. Jeffrey L. Rubinstein.