Was al-Khidr a Prophet?
Question

Was al-Khidr an angel, a Messenger, a Prophet or a wali (“saint”)?
Praise be to Allah.From the general meaning of the Quranic verses, it appears that Al-Khidr was a prophet. 
Shaykh al-Shanqiti (may Allah have mercy on him) said in his commentary on the verse (interpretation of the meaning):
“Then they found one of Our slaves, on whom We had bestowed mercy from Us, and whom We had taught knowledge from Us” [al-Kahf 18:65]
“But it may be understood from some verses that the mercy mentioned here was the mercy of prophethood, and that this knowledge which came from Allah was the knowledge of revelation. It is known that mercy and the bestowal of knowledge from Allah is more general and comes in more ways than via prophethood. The fact that something general exists does not necessarily imply that something more specific exists, as is well known. One of the indications that the mercy and knowledge with which Allah blessed His slave al-Khidr came by way of prophethood and revelation is the verse (interpretation of the meaning): 
“And I did them not of my own accord” [al-Kahf 18:82] i.e., rather I did them by the command of Allah, and the command of Allah is only conveyed via revelation, because there is no way for the commands and prohibitions of Allah to be known except through revelation from Allah, especially with regard to the killing of an apparently innocent soul and damaging a ship by making a hole in it, because committing acts of aggression against people’s lives and wealth can only be validated via revelation from Allah. 
Allah has restricted the method of warning to revelation as He says (interpretation of the meaning): 
“Say (O Muhammad): “I warn you only by the Revelation” [al-Anbiya 21:45] 
The word innama (translated here as “only”) implies limitation or restriction.” (Adwa al-Bayan, 4/172, 173)
And he said: 
“From all of this, we know that al-Khidr’s killing the boy and making a hole in the ship, and his saying, 
“And I did them not of my own accord” [al-Kahf 18:82 – interpretation of the meaning] clearly indicates that he was a Prophet. Al-Fakhr al-Razi, in his tafsir, attributed the view that he was a prophet to many scholars. Another factor that may indicate that he was a prophet is the fact that Musa (peace be upon him) humbled himself before him and said (interpretation of the meaning): 
“May I follow you so that you teach me something of that knowledge (guidance and true path) which you have been taught (by Allah)?” [al-Kahf 18:66] 
“If Allah wills, you will find me patient, and I will not disobey you in aught” [al-Kahf 18:69] even though al-Khidr said to him (interpretation of the meaning): 
“And how can you have patience about a thing which you know not?” [al-Kahf 18:68]” (Adwa al-Bayan, 3/326)
For more, please see these answers: 26117 , 311269 , and 7459 .
And Allah knows best.