The story of Moses and Khidr is mentioned in Surah Al-Kahf (Chapter 18, verses 60-82). You can read the story here,
18:65 And they found a servant from among Our servants to whom we had given mercy from us and had taught him from Us a [certain] knowledge.
18:66 Moses said to him, “May I follow you on [the condition] that you teach me from what you have been taught of sound judgement?”
18:67 He said, “Indeed, with me you will never be able to have patience.
18:68 And how can you have patience for what you do not encompass in knowledge?”
18:69 [Moses] said, “You will find me, if Allah wills, patient, and I will not disobey you in [any] order.”
18:70 He said, “Then if you follow me, do not ask me about anything until I make to you about it mention.”
18:71 So they set out, until when they had embarked on the ship, al-Khidh r tore it open. [Moses] said, “Have you torn it open to drown its people? You have certainly done a grave thing.”
18:72 [Al-Khidh r] said, “Did I not say that with me you would never be able to have patience?”
18:73 [Moses] said, “Do not blame me for what I forgot and do not cover me in my matter with difficulty.”
18:74 So they set out, until when they met a boy, al-Khidh r killed him. [Moses] said, “Have you killed a pure soul for other than [having killed] a soul? You have certainly done a deplorable thing.”
18:75 [Al-Khidh r] said, “Did I not tell you that with me you would never be able to have patience?”
18:76 [Moses] said, “If I should ask you about anything after this, then do not keep me as a companion. You have obtained from me an excuse.”
18:77 So they set out, until when they came to the people of a town, they asked its people for food, but they refused to offer them hospitality. And they found therein a wall about to collapse, so al-Khidh r restored it. [Moses] said, “If you wished, you could have taken for it a payment.”
18:78 [Al-Khidh r] said, “This is parting between me and you. I will inform you of the interpretation of that about which you could not have patience.
18:79 As for the ship, it belonged to poor people working at sea. So I intended to cause defect in it as there was after them a king who seized every [good] ship by force.
18:80 And as for the boy, his parents were believers, and we feared that he would overburden them by transgression and disbelief.
18:81 So we intended that their Lord should substitute for them one better than him in purity and nearer to mercy.
Some misguided individuals have distorted the above passage and claim that it sanctions ‘Honour killing’. They have taken this innocent story and taken it apart that ‘a father can kill his son’ without getting punished under Islamic Law. To some this story might sound strange, why would Khidr kill a kid? According to majority of scholars of the past and present, they have stated that if the kid had grown up, he would have oppressed and turned his innocent parents who were believers to disbelief. According to Scholars (read commentary of Scholar Sayyid Abul Ala Maududi below), Khidr was not a human being but an Angel (or other kind of creation). Human beings are forbidden to do such. Under Islamic Law, a parent is forbidden to kill his son or daughter. In one of our early Hadith, Prophet Muhammed (p) has stated that a parent is not allowed to kill one of their own children, and if a parent does so, then there will be legal punishment carried out on the father or mother.
Narrated ‘Ubada bin As-Samit: Allah’s Messenger said to us while we were in a gathering, “Give me the oath (Pledge of allegiance for: (1) Not to join anything in worship along with Allah, (2) Not to steal, (3) Not to commit illegal sexual intercourse, (4) Not to kill your children, (5) Not to accuse an innocent person (to spread such an accusation among people), (6) Not to be disobedient (when ordered) to do good deeds. The Prophet added: Whoever amongst you fulfill his pledge, his reward will be with Allah, and whoever commits any of those sins will receive the legal punishment in this world for that sin, then that punishment will be an expiation for that sin, and whoever commits any of those sins and Allah does not expose him, then it is up to Allah if He wishes He will punish him or if He wishes, He will forgive him.” So we gave the Pledge for that. 
Reading the above Prophetic saying, it is abundantly clear that ‘honour killing’ is not endorsed in Islam.
Sayyid Abul Ala Maududi – Tafhim al-Qur’an – The Meaning of the Qur’an
In connection with this story, a very hard problem arises to which an answer must be found: Two of the three things done by Hadrat Khidr are obviously against those commandments of the Law which have always been in force since the creation of man. No law allows anyone the right to damage the property of another and kill an innocent person. So much so that if a man were to know by inspiration that some usurper would illegally seize a certain boat, and that a certain boy would be involved in a rebellion and unbelief, even then no law, sent down by Allah, makes it lawful that one should bore a hole in the boat and kill the innocent boy by virtue of one’s inspiration.
If in answer to this, one were to say that Hadrat Khidr committed these two acts by the Commands of Allah, this does not solve the problem, for the question is not this, “By whose command did Hadrat Khidr commit these acts”? but it is this: “What was the nature of these commands”? This is important because Hadrat Khidr did these acts in accordance with Divine Command, for he himself says that these acts of his were not done by his own authority, but were moved by the mercy of Allah, and Allah Himself has testified this by saying: “We gave him a special knowledge from Ourselves”. Thus it is beyond any doubt that these acts were done by the Command of Allah, but the question about the nature of the command remains there, for it is obvious that these commands were not legal because it is not allowed by any Divine Law, and the fundamental principles of the Qur’an also do not allow that a person should kill another person without any proof of his guilt. Therefore we shall have to admit that these commands belonged to one of those decrees of Allah in accordance with which one sick person recovers, while another dies: one becomes prosperous and the other is ruined. If the Commands given to Hadrat Khidr were of this nature, then one must come to the conclusion that Hadrat Khidr was an angel (or some other kind of Allah’s creation) who is not bound by the Divine Law prescribed for human beings, for such commands as have no legal aspect, can be addressed to angels only.
This is because the question of the lawful or the unlawful cannot arise about them: they obey the Commands of Allah without having any personal power. In contrast to them, a man shall be guilty of a sin whether he does any such thing inadvertently by intuition or by some inspiration, if his act goes against some Divine Commandment. This is because a man is bound to abide by Divine Commandments as a man, and there is no room whatsoever in the Divine Law that an act may become lawful for a man merely because he had received an instruction by inspiration and had been informed in a secret way of the wisdom of that unlawful act.
The above-mentioned principle has been unanimously accepted by scholars of the Divine Law and the leaders of Sufism. `Allamah Alusi has cited in detail the sayings of ‘Abdul Wahhab Shi`irani, Muhy-ud-Din ibn-`Arabi, Mujaddid Alf Thani, Shaikh ‘Abdul-Qadir Jilani, Junaid Baghdadi, Sirri Saqti, Abul-Hussain An-nuri, Abu Said-al-Kharraz, Ahmad ud-Dainauri and Imam Ghazzali to this effect that it is not lawful even for a sufi to act in accordance with that inspiration of his own which goes against a fundamental of law. (Ruh-ul-Ma ani, Vol. XVI, pp. 16-18). That is why we have come to the conclusion that Hadrat Khidr must be an angel, or some other kind of Allah’s creation, exempted from human law, for he could not be the only exception to the above-mentioned formula. Therefore we inevitably come to the conclusion that he was one of those Servants of Allah who act in accordance with the will of Allah and not in accordance with the Divine Law prescribed for human beings.
We would have accepted the theory that Hadrat Khidr was a human being, if the Qur’an had plainly asserted that the “servant” to whom Prophet Moses was sent for training, was a man, but the Qur’an does not specifically say that he was a human being but says that he was “one of Our Servants” which does not show that he was necessarily a human being. Besides this, there is no Tradition which specifically says that Hadrat Khidr was a human being. In the authentic traditions related by Said bin Jubair, Ibn `Abbas, Ubayy bin Ka`ab from the Holy Prophet, the Arabic word, ,}i~ (rajul) has been used for Hadrat Khidr, which though generally used for human beings, is not exclusively used for human beings. In the Holy Qur’an itself, this word has been used for Jinns also (LXXIII 6). It is also obvious that when a jinn or an angel or an invisible being will come before a human being, he will surely come in human shape and, in that form; he will be called a bashar (man), just like the angel who came before Mary in the shape of a human being (XIX: 17). Thus the word rajul, used for Hadrat Khidr in the above mentioned Tradition by the Holy Prophet, does not necessarily mean that he was a human being. Therefore we are quite justified in the light of the above discussion to believe that Hadrat Khidr was one of the angels or some other kind of Allah’s creation who is not bound by the Divine Law prescribed for human beings. Some of the former scholars of the Qur’an have also expressed the same opinion which. has been cited by lbn Kathir in his Commentary on the authority of Mawardi. 
(1) “India’s Forbidden Love: An Honour Killing on Trial” (11th March 2018) https://www.aljazeera.com/programmes/witness/2018/03/india-forbidden-love-honour-killing-trial-180306074425327.html
(1) – ” Honour Killing” – “Jealous dad-of-eight knifed wife in the heart after seeing her talking to another man”. NAME: Robert Bance. (20th January 2017) https://www.mirror.co.uk/news/uk-news/jealous-dad-eight-knifed-wife-9656492
(2) – “Christian Parents and Uncle of Slain Israeli Teen Arrested on Suspicion of Murder” 15th June 2017. Brief info,
“Henriette Karra, from a Christian family, had filed a complaint against her parents, saying her mother threw a pot at her because she objected to her seeing a Muslim boy”.
“Christian man ‘kills teenage daughter over relationship with Muslim prisoner’ in Israel”
 Reference: Sahih al-Bukhari 7213 In-book reference: Book 93, Hadith 73
USC-MSA web (English) reference: Vol. 9, Book 89, Hadith 320
 Sayyid Abul Ala Maududi – Tafhim al-Qur’an – The Meaning of the Qur’an – http://www.englishtafsir.com/Quran/18/index.html#sdfootnote60sym