This story is narrated in sura al-Kahf, chapter 18 of Quran.

●Moses is Informed of a Wise Man

Musa AS was one of the great prophets. One day, when he gave an impressive sermon and everyone who heard it was moved. Someone from the congregation asked:"0 Messenger of Allah, is there another man on earth more learned than you?" Musa AS, believing that Allah had given him the power of miracles and honored him with Torah replied "No". 
However, Allah revealed to him that no man could know everything that is to know not would the messenger be a custodian of all knowledge. There are many secrets of this world and heavens. And gives whom he wishes, there will always be another who knew what others did not. 
Musa AS asked Allah the whereabouts of this man and signs of his identity.
Allah instructed him to take a live fish in a water-filled vessel. He would find the man at a place where this fish disappeared. Musa AS was accompanied by a young man on his journey. They decided to rest at a place where the two rivers met. Musa AS felt asleep instantly.

●Moses Finds Al-Khidr

While Musa AS was asleep, his companion saw the fish wriggle out of the vessel into the river. He, however, forgot about it by the morning. They resumed their journey next morning and soon after covering some distance they felt hungry. It was then the companion of Musa AS remembered about the fish. Hearing the unusual event Musa AS exclaimed: "This is exactly what we are seeking!" 
They hurriedly retraced their steps to the place where the rivers met and where the fish had jumped out. There they found out what they were seeking. A saintly man, his face partly covered by the hood. He was al Khizir - the guide.

●Moses Finds Al-Khidr - Quranic

Allah the Almighty narrated: And (remember) when Moses said to his boy-servant: "I will not give up (traveling) until I reach the junction of the two seas or (until) I spend years and years in traveling."
But when they reached the junction of the two seas, they forgot their fish, and it took its way through the sea as in a tunnel. So when they had passed further on (beyond that fixed place), Moses said to his boy-servant: "Bring us our morning meal; truly, we have suffered much fatigue in this, our journey."
He said: "Do you remember when we betook ourselves to the ock? I indeed forgot the fish, none but Satan made me forget to remember it. It took its course into the sea in a strange (way)!"
(Moses) said: "That is what we have been seeking." So they went back retracing their footsteps.
Then they found one of Our slaves, unto whom We had bestowed mercy upon Us, and whom We had taught knowledge from Us. [Surah 18: 60-65]

●Moses Speaks to Al-Khizir

Moses said to him (Khizir) "May I follow you so that you teach me something of that knowledge (guidance and true path) which you have been taught (by Allah)?"
He (Khizir) said: "Verily! You will not be able to have patience with me! And how can you have patience about a thing which you know not?"
Moses said: "If Allah wills, you will find me patient, and I will not disobey you in aught."
He (Khizir) said: "Then if you follow me, ask me not about anything till I myself mention it to you.
So they both proceeded, till, when they were on the ship, he (Khizir) scuttled it. Moses said: "Have you scuttled it in order to drown its people? Verily, you have done Imra - a Munkar (evil, bad, dreadful) thing."
He (Khizir) said: "Did I not tell you, that you would not be able to have patience with me?"
(Moses) said: "Call me not to account for what I forgot, and be not hard upon me for my affair (with you)."
Then they both proceeded, till they met a boy, he (Khizir) killed him. Moses said: "Have you killed an innocent person who had killed none? Verily, you have done Nukra a great Munkar (prohibited, evil, dreadful) thing!"
(Khidr) said: "Did I not tell you that you can have no patience with me?"
(Moses) said: "If I ask you anything after this, keep me not in your company, you have received an excuse from me."
Then they both proceeded, till, when they came to the people of a town, they asked them for food, but they refused to entertain them. Then they found therein a wall about to collapse and he (Khizir) set it up straight. (Moses) said: "If you had wished, surely you could have taken wages for it!"
(Khizir) said: "This is the parting between me and you. I will tell you the interpretation of (those) things over which you were unable to hold patience.
'As for the ship, it belonged to poor people working in the sea. So I wished to make a defective damage in it, as there was a king after them who seized every ship by force.
"And as for the boy, his parents were believers, and we feared lest he should oppress them by rebellion and disbelief. So we intended that their Lord should change him for them for one better in righteousness and near to mercy.
"And as for the wall, it belonged to two orphan boys in the town; and there was under it a treasure belonging to them; and their father was a righteous man, and your Lord intended that they should attain their age of full strength and take out their treasure as a mercy from your Lord. And I did it not of my own accord. That is the interpretation of those (things) over which you could not hold patience. 
[Surah 18: 60-82]

●Moses Seeks Al-Khizir - Hadith

The story of Moses and Al-Khidr is also told in a hadith. Said Ibn Jubair said: "I said to Ibn Abbas, 'Nauf Al-Bukah claims that Moses, the companion of Al-Khizur, was not Moses (the prophet) of the children of Israel, but some other Moses.' Ibn Abbas said: 'Allah's enemy (i.e. Nauf) has told a lie.

●Moses Talks to Al-Khidr

Moses greeted him, and he replied saying: "How do people greet each other in your land?" Moses said: "I am Moses."
The man asked: "Moses of Bani Israel?" Moses said: 'Yes, I have come to you so that you may teach me from those things which Allah has taught you." He said: "0 Moses! I have some of the knowledge of Allah which Allah has taught me and which you do not know, while you have some of the knowledge of Allah which Allah has taught you and which I do not know." Moses asked: "May I follow you?" He said: "But you will not be able to remain patient with me, for how can you be patient about things which you will not be able to understand?" Moses said: 'You will find me, if Allah so will, truly patient, and I will not disobey you in aught."
So both of them set out walking along the sea-shore. A boat passed by them, and they asked the crew of the boat to take them on board. The crew recognized Al-Khidr, so they took them on board without fare. When they were on board the boat, a sparrow came and stood on the edge of the boat and dipped its beak once or twice into the sea. Al-Khidr said to Moses: "0 Moses! My knowledge and your knowledge have not decreased Allah's knowledge except as much as this sparrow has decreased the water of the sea with its beak." Then suddenly Al-Khidr took an adze and pulled up a plank, and Moses did not notice it till he had pulled up a plank with the adze. Moses said to him: "What have you done? They took us on board charging us nothing, yet you have intentionally made a hole in their boat so as to drown its passengers. Verily, you have done a dreadful thing." AlKhidr replied: "Did I not tell you that you would not be able to remain patient with me?" Moses replied: "Do not blame me for what I have forgotten, and do not be hard upon me for my fault." So the first excuse of Moses was that he had forgotten.
When they had left the sea, they passed by a boy playing with other boys. Al-Khidr took hold of the boy's head and plucked it with his hand like this. (Sufyan, the sub-narrator gestured with his fingertips as if he were plucking some fruit.) Moses said to him: "Have you killed an innocent person who has not killed any person? You have really done a horrible thing." Al-Khidr said: "Did I not tell you that you could not remain patient with me?" Moses said: "If I ask you about anything after this, don't accompany me. You have received an excuse from me."
Then both of them went on till they came to some people of a village, and they asked its inhabitants for food but they refused to entertain them as guests. Then they saw therein a wall which was just going to collapse and Al Khidr repaired it just by touching it with his hands. (Sufyan, the sub-narrator, gestured with his hands, illustrating how Al-Khidr passed his hands over the wall upwards.) Moses said: "These are the people whom we have called on, but they neither gave us food, nor entertained us as guests, yet you have repaired their wall. If you had wished, you could have taken wages for it."
Al-Khidr said: "This is the parting between you and me, and I shall tell you the explanation of those things on which you could not remain patient."
The Prophet added: "We wish that Moses could have remained patient by virtue of which Allah might have told us more about their story." (Sufyan, the sub-narrator, said that the Prophet said: "May Allah bestow His Mercy on Musa AS! If he had remained patient, we would have been told further about their case.")'