Commenting on the famous first words of the Torah – "Bereshit Bara Elokim" ("In the beginning, G-d created") – Rashi cites the Midrash which explains the word "Bereshit" to mean, "Bishbil Torah She’nikre’a ‘Reshit’" – "for the Torah, which is called ‘the first’." In other words, the phrase "Bereshit Bara Elokim" means that G-d created the world so that the Torah could be studied and observed. Torah and Misvot are not simply additional components to the world – they are the very purpose for which the world exists in the first place.
We see just how far this idea extends later in the story of creation. The Torah writes (1:14-15) that when G-d announced the creation of the luminaries – the sun, the moon and the stars – He declared, "Let there be luminaries in the firmament of the sky… They shall serve as signs and occasions, for days and for years, and they shall serve as luminaries in the firmament of the sky to illuminate the earth." Rashi explains that the luminaries serve as "signs" in the sense that when an eclipse occurs, this is an inauspicious omen which should motivate us to introspect and repent. The luminaries serve the function of "occasions, for days and for years," Rashi explains, in that we proclaim new months based on the moon’s revolution around the earth. This determination directly affects our halachic observance, as it establishes which days are to be celebrated as Yamim Tobim. The luminaries also determine the halachic times relevant for our daily schedule of Misvot.
Commenting on the next verse – "And they shall serve as luminaries…to illuminate the earth," Rashi writes, "And this [function], too, they shall serve – to illuminate the earth."
The Hafetz Haim (Rav Yisrael Meir Kagan of Radin, 1839-1933) notes the startling implication of Rashi’s comments – that illumination is only the secondary function of the sun and the moon. Their primary function is to facilitate our Misva observance, to enable us to determine the days when our holidays are to be celebrated, and to inspire repentance. Providing light and warmth is secondary – "This function, too, they shall serve…"
Another example of this concept can be found in the Gemara, in Masechet Berachot (41), discussing the famous verse in the Book of Debarim (8:8) which praises the Land of Israel for seven species of grains and fruits (wheat, barley, vines, figs, pomegranates, olives, dates). The land is blessed with these species, the Gemara explains, because they inform us of halachic "Shiurim" ("quantities"). For example, the size of an olive is the volume which constitutes a halachic act of "eating." The size of a large date is the amount of food whose consumption violates the Yom Kippur fast, rendering the transgressor liable to the punishment of "Karet." These foods are all tasty and nutritious, but this is only their secondary function. The primary purpose for which they were created is to establish Halachot, to help us observe the Torah – the purpose of all of existence.
This fundamental teaching should "rewire" our minds and force us to look upon the world, and our lives, from an entirely new perspective. If the universe was created solely for the purpose of Torah and Misvot, then our lives must revolve around Torah and Misvot. We are certainly allowed to enjoy the physical and material blessings of this world, but our primary focus must be directed toward the study and observance of Torah. Right away, in the very first words of the Torah, we are taught that this must be our highest priority. Although we involve ourselves in many different things, and we of course need to earn a livelihood and tend to our physical needs, we must remember that our primary point of focus and highest priority is always serving G-d through the study of Torah and performance of Misvot.