Al-Khidr is best known for his appearance in the Qur'an in sura al-Kahf. Although not mentioned by name in the āyah "verse", al-Khidr is assumed to be the figure that Musa "Moses" accompanies and whose seemingly violent and destructive actions so disturb Moses that he violates his oath not to ask questions.
After he and Moses board a ship, Al-Khidr performs his first action, remaining behind and damaging the ship, rendering it unsafe for use. Forgetting his oath to follow quietly, Moses criticizes this behavior and Al-Khidr replies that criticizing him is a violation of the oath. Moses, eager to learn from the wise man, apologizes. The second act was Al-Khidr murdering a child. Moses, in anger, violates his oath again. As with the sabotage of the ship, they argue and Moses apologizes for violating his oath. This time Al-Khidr warns Moses that he has only one chance left as his patience is wearing thin. The last act was Al-Khidr restoring a damaged wall in a village where they were denied hospitality. Amazed by his companion's reaction to the ill-treatment they received in the village, Moses violates his oath for the third and last time.
Al-Khidr exposed to Moses two facts simultaneously, first that Moses' knowledge is limited and that many acts which seem to be evil, malicious or somber hide some of God's mercy and design. As they are about to part ways, Al-Khidr explains that even though the ship's owners will not be pleased with their damaged ship, the blessing will manifest itself when the local king confiscates all ships fit to wage war, leaving behind the damaged ships.
The murder of the child would sadden his parents at first glance, yet is a blessing in disguise as God would replace the child with better in purity, affection and obedience. Unlike the murdered child, who Al-Khidr foretold was about to make his pious parents suffer. As for the restoration of the wall without recompense, Al-Khidr explained that underneath the wall was a treasure belonging to two hapless orphans whose father was a righteous man. As God's envoy, Al-Khidr restored the wall, showing God's kindness by rewarding the piety of the orphans' father.
Al-Khidr also figures into the Alexander Romance as a servant of Alexander the Great,Al-Khidr and Alexander cross the Land of Darkness to find the Water of Life. Alexander gets lost looking for the spring, but Al-Khidr finds it and gains eternal life. Dhul Qarnain which means literally,"Two-Horned One", is mentioned as the one who imprisons the Gog and Magog. In the Jordanian city of Mahis there is a Mausoleum to Al-Khidr.
The place of the meeting of the two seas signifies the time when the Mosaic dispensation meets the Islamic dispensation, i.e. when the Mosaic dispensation will be superseded by the Islamic one.
The first action of “the servant of God” (Al-Khidr) of making a hole in the boat is interpreted as signifying the commandments laid down by Muhammad which would, as it were make a hole in the boat, which in spiritual terms denotes worldly riches, i.e. he would see to it that wealth is fairly distributed and does not accumulate in the hands of a few. The “poor people” to whom the boat belonged represent the Muslims, and making a hole in it means that Islam would exhort its followers to spend in the way of God by way of Zakat and charity. Which would seem to be a source of economic weakness, but in fact would be one of economic strength and prosperity? The tyrant king, who confiscates the boats were the Byzantine and Persian Empires who would have seized Arabia had it not seemed to them a poor and barren land not worth conquering. Thus the Arabian land represented as the damaged boat had been safeguarded from being conquered or "taken by force".
The youth, in spiritual terms is interpreted among other things as Ignorance, strength and wild impulses, thus the second action of the “servant of God”, the killing of the youth signifies that the teachings of his (Muhammad's) religion would require its followers to bring about a veritable death over their carnal desires and passions. The source (the parents) of these carnal desires, impulses and passions is the human body and soul combined, from which all moral qualities spring. Islamic theology holds that every human is born virtuous, thus because his parents have been called “believers”, this means that the believers may be dragged into vice by the impulses represented as the “youth”. Islam seeks to eradicate these impulses and leaves man with the soul and body combined to develop along beneficent lines to achieve the high purpose of human life.
Then Moses and the “servant of God” approach a town, ask its people for food and are refused to be accepted as guests. This signifies that both Moses and Muhammad would seek co-operation from Jews and Christians but it would be denied. The two orphan boys to whom the wall belonged are Moses and Jesus and their “righteous” father is Abraham. Their treasure was the true teaching bequeathed by them to their peoples, which was in danger of being lost due to the latter’s irreligiousness. Thus the third act of the “servant of God” (Muhammad) of rebuilding the wall signifies that the treasure or true teachings were to be safeguarded in the Quran, so that they (the people of Moses and Jesus) may accept it after having awakened to a realization of the truth of the Quranic teachings.
The story is also similar to one told of a journey made by the prophet Elijah and Rabbi Jochanan. The first house where they stay the night belongs to a pious old couple who give the prophet and the rebbe the best of their food and beds. However, the couple's cow dies in the night. Elijah later explains that the Angel of Death came and he persuaded the angel to take the cow instead of the wife. The next house, as in the al-Khidr story, is that of a rich miser, and Elijah repairs his wall so that he will not, in having it repaired, find the treasure hidden under it.