Verses 9 - 26 of the chapter tell the story of the People of the Cave (Ashabu Al-Kahf). Some number of young monotheistic men lived in a time where they were persecuted. They fled the city together, and took refuge in a cave where they fell asleep. God caused them to remain sleeping for 300 or 309 years, and when they woke the surrounding area had become monotheistic as well.
Surah al-Kahf also mentions the ruh, or soul/spirit in verse 28, and in the Parable of Two Men in verses 32 - 44. This story discusses two men who had both been given blessings from God, but one wronged his soul by saying that none of it could ever be taken away from him. At the end of the parable God destroys what he had given the man.
The third main story within the chapter (verses 60 - 82) is that of Moses traveling to gain knowledge from another servant of God who is never mentioned by name, but from other sources is called Al-Khidr.
Muslim philosophers, such as al-Farabi, Avicenna, and al-Kindi enthusiastically embraced the concept of Dhul-Qarnayn being an ancient Greek king. They stylized Dhul-Qarnayn as a Greek philosopher-king. Most scholars agree that Dhul-Qarnayn is a reference to Alexander the Great, who is ascribed similar adventures in the Alexander romance. In later days, some scholars, for example Maududi, identifies Dhul-Qarnayn as Cyrus the Great.
Most Muslim scholars believe he was not merely of Greek origin but a man of God, a religious man who was able to build a partition to save people from Gog and Magog. In accordance with some Islamic jurisprudence, near the End Times, Gog and Magog will learn the secret that will set them free and they will once again wreak havoc upon the world.
The earliest mention of Dhu l-Qarnayn, outside the Qur'an, is found in the works of the earliest Muslim historian and hagiographer, Ibn Ishaq, which form the main corpus of the Sira literature. Ibn Ishaq's Sira reports that the eighteenth chapter of the Qur'an (which includes the story of Dhu l-Qarnayn) was revealed to Muhammad by Allah on account of some questions posed by rabbis residing in the city of Medina - the verse was revealed during the Meccan period of Muhammad's life. According to Ibn Ishaq, Muhammad's tribe, the powerful Quraysh, were greatly concerned about their tribesman who had started claiming prophethood and wished to consult rabbis about the matter. The Quraysh sent two men to the rabbis of Medina, reasoning that they had superior knowledge of the scriptures and about the prophets of God. The two Quraysh men described their tribesman, Muhammad, to the rabbis. The rabbis told the men to ask Muhammad three questions:
According to Ibn Ishaq, when Muhammad was informed of the three questions from the rabbis, he said that he would have the answers in the morning but did not say "if God wills it". For fifteen days, Muhammad awaited eagerly for the revelation. Muhammad did not answer the question until then. Doubt in Muhammad began to grow amongst the people of Mecca. Then, after fifteen days, Muhammad received the revelation of al-Kahf as an answer to the questions.
Muhammad also advised Muslims to recite the first and last ten verses of Sura Al-Kahf, as protection from the trials and mischief of the Dajjal (false messiah