Al-Khidr is the righteous servant mentioned by Almighty Allah in the Glorious Qur’an in Surat Al-Kahf whom Prophet Musa (peace and blessings be upon him) accompanied and learnt from him. When Prophet Musa accompanied him, he (Al-Khidr) did things such as making a hole in a ship, etc. and then he explained why he did such things for Musa (peace and blessings be upon him). 

Muslim scholars differed whether he was a prophet or only a righteous person. The most correct view is that he was a prophet as this is apparent in the Qur’anic verse which reads: “And I did them not of my own accord…” (Al-Kahf 18: 82) It is an evidence that he did these things based on Allah’s commands for him and not from his own self. So, the most correct view is that he was a prophet.