This question doesn’t have a brief answer. Please click on the detailed answer.
It should be noted that the Quran hasn’t clearly mentioned the name of Khidhr, yet he has been referred to as “One of Our servants whom We had granted a grace from Ourselves, and taught him a knowledge from Our own”  (which indicates his high degree of servitude and exceptional knowledge) and the teacher of Prophet Musa (pbuh). This high character that the Quran speaks of has been introduced as Khidhr in many hadiths.
He was a divine scholar whom Allah (swt) had bestowed His special grace and mercy upon, was responsible for some of the inner matters of this world, knew some of the world’s secrets and was a teacher to Prophet Musa (pbuh) in some respects, although Prophet Musa (pbuh) was higher than him in others.
Some hadiths and verses of the Quran imply that he was a prophet and messenger of Allah (swt) to his tribe and people, to invite them to tawhid (the oneness of God) and accepting Allah’s (swt) prophets and the divine books. His miracle was that whenever desired, he could revive any dead and dry branch or dry and barren land, making it green again, thus being given the title “Khidhr”. His real name is Talya ibn Malekan ibn Aber ibn Arafkhshad (ارفخشد) ibn Sam ibn Nuh.
As for the prolonged life of this prophet, we would like to draw your attention to a hadith from Imam Sadiq (as): “…“…As for the servant of Allah (swt) Khidr, Allah (swt) extended his life, but not because of his prophetic mission, nor in order to reveal a book onto him, nor to nullify through him, the religion of the past prophets, nor for him to become leader to a nation following him, nor for the obedience that Allah (swt) had made obligatory upon him, but He (Allah (swt)) extended his life because He had chosen to lengthen the occultation of the Qa’im (Imam Mahdi (as)) and knew that some of the people would begin doubting about him as a result, so He lengthened the life of this good servant of His in order for it to be reason for accepting the long life of the Qa’im and so that his life would be compared with the imam’s, rejecting the objection and criticism of the enemies and the bad-minded. 
He is, without a doubt, still alive and is currently more than six thousand years old  . 
For further information, see:
1- The Quran and Prophet Khidhr, Question 1652 (website: 1663).
2- Prophet Musa’s learning from Khidhr, Question 151 (website: 1879).
 Kamaluddin, vol. 3, pg. 357; Biharul-Anwar, vol. 51, pg. 222.
 Yawmul-Khalas, pg. 157.
 Adopted from Question 1652 (website: 1663).