The Magen Avraham (Orach Chaim 494) quotes the Zohar which records that many talmiday chachomim used to spend the entire night learning in preparation of receiving the Torah.
The Magen Avraham (Orach Chaim 494:1) cites the famous Medrash in Shir HaShirim Rabbah which documents that on the day that Bnei Yisroel were to receive the Torah at Har Sinai, they overslept. Therefore, in order to "make-up" for this mishap and show how much we really do appreciate and love the Torah we stay up the entire night learning and preparing to accept it.
The Gemara in Yoma (22a) says: Originally, they never use to perform a lottery to determine who would perform the mitzvah of terumas hadeshen, as they were scared that the person who was picked would sleep in and not make it. The Gemara asks: That for the offering up of the avorim and pedorim [limbs] they made a lottery, even though it was at night at a time when people sleep? The Gemara answers: שאני מיגנא ממיקם. Rashi explains: It’s easier for a person to stay up late at night and wipe sleep from his eyes, then it is for one to get out of bed early in the morning.
The question is, if so, how does staying up all night fix the mishap of oversleeping in the morning, staying up all night is easier than waking up early? Seemingly, what we should be doing on Shavuos morning is, going to sleep and waking up earlier than normal?
Answers:
Perhaps what we can answer is, true waking up early would be more ideal, however, Chazal know how hard it is to get up and they were scared that if they would tell people to wake up early, people may end up making the same mistake Klal Yisroel made by Har Sinai. Therefore, although the most ideal teshuvah would be waking up early, they didn’t want to risk it. Therefore, the closest thing they could do which they thought would work is to tell us to stay up all night. Although, it doesn’t fix the mishap completely, it’s the best they felt they could establish.
Or, we could say, true getting up early would be the most ideal teshuvah, however, Shavuos night is such a special time for learning, it just didn’t come in to tell people to go to sleep.