As stated by other the midrash comes from Shemot Rabbah 1:31.
As to the lesson of the Midrash... there are many. It's a long midrash. Using, DoubleAA's translation I'll go through it line by line.
And the daughter of Pharoh would hug and kiss Moses as if he were her
son and she would not take him out from the kings palace.
This sets us up for when Moshe finally does leave the palace, and sees the Egyptian beating the Jewish Slave. It tells us of Moshe being a sheltered and charismatic person from his birth. This sheltering, is one of the reason he was able to become such a holy man.
And since Moses was so beautiful everyone wanted to see him and anyone
who saw him would not leave. And Pharoh himself would hug and kiss
Moses and Moses would take the crown off Pharoh's head and place it on
his own, just as he would do in the future when he grew up....
While adding to his Charisma, this section also explains to us the test, since the Torah itself never tells us that Moshe took over Pharoah's malchut. In the Torah, that theme doesn't seem to be apparent, while it is a large theme in the midrashim. It highlights the importance of charisma to be a leader, and it show Moshe as the Kingship, while Aaron has the Kahuna. It hints to the transfer of leadership from the Firstborns of Israel to the Levites after another incident with gold.. the golden calf.
And sitting [before Pharoh and Moses] were the magicians of Egypt,
and they said [to Pharoh], "We fear this [child] who takes your crown
and puts it on his head, lest he be the one that we have said is going
to take the kingship from you." Some suggested to kill him [by sword]
while some suggested to burn him.
This is the way of wicked people. Kill the baby now out of fear that they will grow up to be an enemy in the future. It was this logic which caused Pharoah to oppress and enslave the Jews in the first place. Moshe here becomes a symbol of the Jewish people, who over the years get persecuted either by the sword or by burnings (of the beit hamikdash)
And Jethro (Yitro) was sitting among them and said, "This child has no
intellect!" So they tested him and brought before him a bowl of gold
and a bowl of coals. If he would grab the gold then he had intellect
and they would kill him. If he grabbed the coals, then not and he
would be free.
Here, Yitro is the middle voice, and Yitro as a member of Pharoah's court comes up often. He is the archetype of the "righteous gentile" who helps the Jewish people out of wisdom and middle temperance even though he does not join them officially. There is also the running theme of midah kneged midah here, where the suggestion of burning or killing, is associated with metal and coals.
Moses reached for the gold, but the angel Gabriel came and pushed his
hand, and he** grabbed the coal and he** inserted it with Moses's hand
into Moses's mouth and it burned Moses's tongue.
Even though at this point in time, Moshe could have taken the crown, for he was born into greatness, and according to this midrash even born with great intelect, that rightful declaration of Moshe as king, was not to be done at this time. So Gabriel, who strengthens people by withholding what they deserve at this time, saves moshe and the Jewish people by forcing him to towards the coals and humility.
And this is how Moses developed his speech impediment.
This is why Moshe could not speak well. He was too humble and could not assert his rights towards the kingship. His poor ability to speak to the king of Egypt would later blossom into his great ability to speak to, and lead, the Jewish people.