(14) They found written in the Teaching that the LORD had commanded Moses that the Israelites must dwell in booths during the festival of the seventh month, (15) and that they must announce and proclaim throughout all their towns and Jerusalem as follows, “Go out to the mountains and bring leafy branches of olive trees, pine trees, myrtles, palms and [other] leafy-a trees to make booths, as it is written.” (16) So the people went out and brought them, and made themselves booths on their roofs, in their courtyards, in the courtyards of the House of God, in the square of the Water Gate and in the square of the Ephraim Gate. (17) The whole community that returned from the captivity made booths and dwelt in the booths—the Israelites had not done so from the days of Joshua son of Nun to that day—and there was very great rejoicing.
(ט) ויחוגו חג לה' שמונת ימים כימי חג הסוכות, ויזכרו את הימים מקדם בחגגם את חג הסוכות בהרים ובמערות, ויתעו בישימון כבהמות שדה.
(י) ויקחו ערבי נחל וכפות תמרים וישירו שיר שבח והודיה לה', אשר נתן להם עוז ותשועה לטהר את בית מקדשו.
(9) And they celebrated the Festival to the Lord for eight days, like the festival of Sukkot, and they remembered the previous days when they celebrated of the festival of Sukkot in the mountains and in the caves, and they went out in the desolation/wildnerness, like wild beasts.
(10) And they took the willows of the brook and the branches of palm trees, they and sang a song of praise and thanksgiving to the Lord, who gave them courage and salvation to purify the temple of his holiness.
...MISHNA: And where in the recitation of hallel would they wave the lulav? They would do so at the verse: “Thank the Eternal, for God is good” (Psalms 118:1, 29) that appears at both the beginning and the end of the psalm, and at the verse: “Adonai, please save us” (Psalms 118:25); this is the statement of Beit Hillel. And Beit Shammai say: They would wave the lulav even at the verse: “Lord, please grant us success” (Psalms 118:25). Rabbi Akiva said: I was observing Rabban Gamliel and Rabbi Yehoshua and saw that all the people were waving their lulavim, and the two of them waved their lulav only at: “Adonai, please save us,” indicating that this is the halakha.
GEMARA: ...Rabbi Yoḥanan said: He moves them to and fro to dedicate them to He Whom the four directions are His. He raises and lowers them to He Whom the heavens and earth are His.
In the West, Eretz Yisrael, they taught it as follows. Rabbi Ḥama bar Ukva said that Rabbi Yosei, son of Rabbi Ḥanina, said: He moves them to and fro in order to request a halt to harmful winds, storms and tempests that come from all directions; he raises and lowers them in order to halt harmful dews and rains that come from above.
Rabbi Yosei bar Avin said, and some say that it was Rabbi Yosei bar Zevila who said: That is to say, non-essential aspects of a mitzva avert calamity, as waving is a non-essential aspect of the mitzva, since even if one failed to wave the loaves of the show-breads in the Temple, he fulfilled his obligation, and nevertheless it halts harmful winds and dews. And Rava said: And likewise one should conduct himself the same way with a lulav, i.e., one should wave it to and fro and raise and lower it for the same reasons.
When Rav Aḥa bar Ya’akov would move the lulav to and fro, he would say: This is an arrow in the eye of Satan. The Gemara notes: That is not a proper manner of conduct, as it will induce Satan to come to incite him to sin. Gloating due to his victory over the evil inclination will lead Satan to redouble his efforts to corrupt him.
(מ) וּלְקַחְתֶּ֨ם לָכֶ֜ם בַּיּ֣וֹם הָרִאשׁ֗וֹן פְּרִ֨י עֵ֤ץ הָדָר֙ כַּפֹּ֣ת תְּמָרִ֔ים וַעֲנַ֥ף עֵץ־עָבֹ֖ת וְעַרְבֵי־נָ֑חַל וּשְׂמַחְתֶּ֗ם לִפְנֵ֛י יְהֹוָ֥ה אֱלֹהֵיכֶ֖ם שִׁבְעַ֥ת יָמִֽים׃
(40) On the first day you shall take the product of hadar trees, branches of palm trees, boughs of leafy trees, and willows of the brook, and you shall rejoice before the LORD your God seven days.
The Peculiar History of the Etrog By Rachel Scheinerman,
https://jewishreviewofbooks.com/articles/3467/the-peculiar-history-of-the-etrog/
The etrog is indigenous not to the Land of Israel but to China (most commonly associated with mandarins but a cradle for many citrus species). Several millennia ago it grew most abundantly in Yunnan, a southwestern Chinese province, where it is still used, to this day, in traditional Chinese medicine. (The most common variety is called “Buddha’s hand” because it has spiny, finger-like extensions; it looks kind of like a sea anemone.) From there, it travelled to northeastern India and westward across the subcontinent, where it was now called bijapura (meaning “seed-filled” and conjuring the image of something that is “semen-filled”), matulunga, or jambhila and became a component of traditional Ayurvedic medicines used to treat everything from stomach complaints to hemorrhoids to infertility. One of the Buddhist gods, Jambhala (recall, the etrog was sometimes called jambhila), was often depicted holding an etrog as a symbol of fertility because of its high density of seeds. (One is reminded of the medieval Ashkenazi custom for a pregnant woman to bite off the tip of the etrog at the end of the holiday.) When Darius I conquered India in 518 B.C.E., the fruit spread to Persia. Now it was called wādrang, which seems to be the linguistic precursor to the Aramaic word “etrog”...
But why would Jews have decided that when the Torah commanded them to bring the pri etz hadar on the 15th day of the seventh month it meant the etrog, a fruit that was unknown in the Land of Israel before the Persians? Moster explains that as Jewish practice became increasingly legalistic and textual—which is to say, as Jews began to look in scripture for more concrete rules about ritual—texts like Leviticus 23:40 and ambiguous phrases like “pri etz hadar” suddenly cried out for halakhic definition and explanation. Some ancient sources, including less canonical Aramaic translations of the Bible (Targum Pseudo-Jonathan and Neofiti) and a rabbi quoted in the Jerusalem Talmud, interpreted this phrase as simply “fruit from beautiful trees.” But by the end of the Second Temple period, the much more specific identification of pri etz hadar as etrog—found in Josephus, Targum Onkelos (the most widely accepted Aramaic translation of the Bible), and the Mishnah—won out. Moster argues that the etrog was chosen as the “beautiful fruit” precisely because it was exotic, the prize of the Ramat Rachel paradise. Unusual in color and smell, used in medicines and rarely consumed because, well, between the thick rind and copious seeds, there simply wasn’t much fruit to be had, the etrog was a good candidate for the role of “beautiful fruit.” The etrog was strange in other ways, too: The tree blossoms year-round and is covered in thorns. And perhaps more significantly, in Israel it cannot grow without a great deal of artificial irrigation. In a year of inadequate rainfall, there would be no etrogs. This may have made it both a symbol of water and a talisman thought capable of calling down rain—a powerful tie-in to the fall harvest festival.
Etrog: How a Chinese Fruit Became a Jewish Symbol, David Z. Moster
I do not know why the etrog was the first citrus fruit to make its way westward from Southeast Asia. Perhaps its anatomy had something to do with it. The etrog has an abnormal abundance of rind, which means it dries out instead of rotting or spoiling like other citrus fruits. This may have allowed its seeds to travel in a safe, fragrant container for hundreds of miles before being replanted. . . . [T]he etrog’s swiftness is not the only way in which it was lucky. It was by no means predetermined that the etrog was to become the peri ‘eṣ hadar of Leviticus 23:40. These three ambiguous Hebrew words allow for an abundance of other identifications, including palm fronds, cedar cones, tree trimmings, olive branches, regular fruit, and myrtle branches. Yet, despite the many possible interpretations, the etrog won out, and has come to be cherished in antiquity and today as the most beautiful and important Jewish fruit. Perhaps, in the twenty-first century in which we live, with its globalism, mass migrations, and melting-pot ethos, the fruit should be conceived of as “beautiful” (hadar) for the successful journey it has made. In many ways, there is nothing more beautiful than a migrant who has been able to leave behind the pressures of his or her youth to find a new homeland in which he or she is loved, honored, and esteemed.