It was revealed to Hazrat Moses that there is a man who has vast knowledge than him, Moses prayed to Allah about his willing to meet the person (Hazrat Khidr), then he was ordered to make a journey, take a cooked fish and you will meet him (Hazrat Khidr) at the place where this fish will missing. Moses started his journey to search for Hazrat Khidr and on how he met him and what are the reasons behind the three acts done by Khidr.
[Taken from Quranic verses from 60 to 82 of Sura Kahf (18)]
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 rock? 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 from us, and whom we had taught knowledge from us.
Moses said to him (Khidr) "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 (Khidr) 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 will, you will find me patient, and I will not disobey you in aught." He (Khidr) 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 embarked the ship, he (Khidr) scuttled it. Moses said: "Have you scuttled it in order to drown its people? Verily, you have committed a thing "Imra" (a Munkar - evil, bad, dreadful thing)." He (Khidr) 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 (Khidr) killed him. Moses said: "Have you killed an innocent person who had killed none? Verily, you have committed a thing "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 (Khidr) set it up straight. Moses said: If you had wished, surely, you could have taken wages for it!" (Khidr) 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 (Masakin) 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."
source : sibtayn