The Quran Verse
Surah 34:14:
And when We decreed for Solomon death, nothing indicated his death to them except a creature of the earth [a worm] eating his staff. But when he fell, it became clear to the jinn that if they had known the unseen, they would not have remained in humiliating punishment.
The Relevant Source Text (Jewish Folklore)
The Babylonian Talmud (Gittin 68a–b, Sanhedrin 20b) Jewish legends from the 3rd to 5th centuries AD describe Solomon’s dominion over demons (shedim). One specific composite legend tells of Solomon dying while leaning on his staff to ensure the demons finished building the Temple. Only when a worm (tolahat) gnaws through the staff does his body fall, revealing to the demons that he was dead all along.
This story is not in the Bible. It is a late, ironic Jewish legend intended to show that even the wisest king is subject to decay.
Critics argue the Quran treats this ironic folklore as a literal, historical event. It serves a specific theological goal in the Surah: to prove that "Jinns" (demons) do not possess knowledge of the "Unseen" (Al-Ghaib). To the historian, this is a clear case of the Quran absorbing the popular Jewish Haggadah (storytelling) of the 7th-century Near East and canonizing it as divine revelation