Arguably the most obscure of Jewish customs is the gathering of the "four species" - a closed date frond, some myrtle boughs and a few willow twigs and shaking them vigorously together with a citron fruit on Sukkoth. The ritual is typically performed during the entire week of Sukkot as a part of the daily prayer service. It seems oddly pagan, and apparently, was once indeed so.
The custom is described in the Bible. And ye shall take you on the first day the boughs of goodly trees, branches of palm trees, and the boughs of thick trees, and willows of the brook; and ye shall rejoice before the LORD your God seven days (Leviticus 23:40).
Putting aside for a moment the issue of the identity of the goodly trees and thick trees for the moment, this seems to confirm the custom as sanctioned by the Bible. But the text does not stipulate that these plants are to be shaken, only that you are to take them.
How Ezra the Scribe understood it 2,500 years ago
As recounted in the Book of Nehemiah, when Ezra the Scribe read this Leviticus verse (if he didn't outright write it, as some think), he took the instructions very differently from the way they are understood today. After reading that the Jews should dwell in booths in the feast of the seventh month (that is, Sukkot), Ezra commands: Go forth unto the mount, and fetch olive branches, and pine branches, and myrtle branches, and palm branches, and branches of thick trees, to make booths, as it is written (8:15).
Evidently, in Ezra's time (roughly the 5th century B.C.E.), the passage in Leviticus was interpreted to mean that different kinds of branches, including date fronds and olive branches, are to be used to build the Sukkot booths. This is in fact how the verse is interpreted to this day by the Samaritans, who splintered away from Judaism at about that time.
So if in the early Second Temple period, the "four species" were used to build Sukkot, when and why did Jews start shake them ceremoniously?
The earliest texts to describe the four species being used ceremoniously, not for building booths, are the Book of Jubilees and 2 Maccabees, both written about 2,100 years ago. Maccabees describes celebrating the dedication of the Temple after the Maccabean defeat of the Greeks:
And they celebrated it for eight days with rejoicing, in the manner of the feast of booths, remembering how not long before, during the feast of booths, they had been wandering in the mountains and caves like wild animals. Therefore bearing ivy-wreathed wands and beautiful branches and also fronds of palm, they offered hymns of thanksgiving to him who had given success to the purifying of his own holy place (10:6-7).
It seems then, that the break in tradition and the change in religious leadership that took place during and after the Maccabean Revolt (167 B.C.E. – 160 B.C.E.), allowed for the old custom to be forgotten and the tradition of the four species to be reinterpreted.
But where did the Maccabees come up with the idea that they should be ceremoniously shaken and not be used for the building of the sukkot? Ironically, from their Greek enemies. It was customary in Hellenistic society of the period to carry date fronds and other branches in victory processions.
Pelted with citrons
So the repurposing of the four species probably took place at the end of the Maccabean Revolt, but what about the identity of the four species? Clearly, in Ezras time the four species were not the same as today, mostly because he interpreted the goodly trees as olive branches, not citron as it is understood today. In fact, Ezra couldnt have gotten his hands on citrons, since they either didnt grow in the area yet, or if they had already arrived from Persia by his day, they only grew in the pleasure garden in a compound belonging to the Persian overlords outside of Jerusalem (today Kibbutz Ramat Rachel). Citrons would only become widely available in the region hundreds of years later, in the Hellenistic period.
When did the switch take place? It would make sense that this happened after the Maccabean Revolt, but 2 Maccabees and the Book of Jubilees dont say anything about waving citrons around, so we dont know. But if it didnt happen then, it probably took place shortly after, since the Jewish historian Josephus tells us that the Hasmonean King Alexander Jannaeus (who reigned from 103 B.C.E. to 76 B.C.E.) was pelted with citrons by an angry mob of worshippers after he botched a holy ceremony during Sukkot. So that if Josephus has his facts straight, citrons must have been adopted as the goodly trees by his time.
It seems then that Jews began shaking their lulavs and etrogs during the Hasmonean period under Greek influence, not quite as tradition has it (and as it says in Leviticus) during the Israelites' desert wanderings thousands of years before.