All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad is His slave and Messenger.
The story of Al-Khidhr and Moosa (Moses), may Allaah exalt their mention, was already mentioned in the Quran without mentioning the name of Al-Khidhr. Allaah Says (what means): {And they found a servant from among Our servants [i.e. al-Khidhr] to whom We had given mercy from Us and had taught him from Us a [certain] knowledge.} [Quran 18:65]
However, the Sunnah clarified that his name was Al-Khidhr. In Saheeh Al-Bukhari, the Prophet said about the story of Al-Khidhr and Moosa that when Moosa claimed to be the most knowledgeable man on earth: ''Allaah revealed to Moosa: Of course, there is our servant Al-Khidhr (who has better knowledge than you)….”
Besides, Al-Bukhari reported in his Saheeh that the Prophet said: ''He was named Al-Khidhr (which literally mean the green man) because he sat on a barren land and the ground turned green with vegetation behind him.”
For more benefit, please refer to Fatwa 82168.
Allaah Knows best.