The basis for staying up Shavuos night is a Zohar in parashat Emor. The relevant segment begins:
166. Come and see, whoever did not number this reckoning, these seven complete Shabbatot, to earn this purity is not considered pure and is not among the pure, nor is he worthy of having a portion in the Torah. And whoever arrives pure on that day, SHAVUOT, and did not lose the count, upon reaching that night OF SHAVUOT, he needs to be occupied in the Torah and unite with it, and keep supernal purity that comes to him on that night, so he is purified.
So what if someone missed a day? He is already not considered pure and is not worthy of having a portion in the Torah. It appears that it is only those who counted are to learn Torah and unite with it? Anyway, the Zohar continues:
167. We learned that one should study this night OF SHAVUOT the Oral Torah, WHICH IS MALCHUT so that MALCHUT AND YISRAEL HER CHILDREN will be purified together by the flowing of the deep river, NAMELY FROM BINAH. After that, during the day ON SHAVUOT the Written Torah, WHICH IS ZEIR ANPIN, will come and join it, MALCHUT, so they will be together, united as one above. A proclamation then resounds concerning him, saying, "As for Me, this is My covenant with them, says Hashem; My spirit that is upon you, and My words which I have put in your mouth..." (Yeshayah 59:21).
168. Therefore the pious in ancient times did not sleep that night but were studying the Torah, saying, Let us come and receive this holy inheritance for us and our children in both worlds. That night, the Congregation of Yisrael is an adornment over them, and she comes to unite with the King. Both decorate the heads of those who merit this.
169. Rabbi Shimon said the following when the friends gathered with him that night: Let us come and prepare the jewels of the bride, NAMELY DRAW MOCHIN UPON MALCHUT, so that tomorrow she will be bejeweled, THAT IS, WITH MOCHIN, and properly ready for the King. Happy is the portion of the friends, when the King will ask the Queen who prepared her jewels, illuminated her crowns and put on her adornments. No one in the world knows how to fix the adornments of the bride save the friends. Happy is their portion in this world and in the World to Come.
That is it. The first known source of the practice of stating up all Shavuos night learning, in a late 13th century kabbalistic work, which may reflect kabbalah from the Tannaim, but may well be a forgery.
We see no mention of this practice in Nigleh, known to be from Chazal. Even as Chazal speak of spending all Pesach night in study, there is no mention of the same for Shavuot.
Even if authentic, this is cast as a kabbalistic practice, with kabbalistic purpose. And it was specifically the chasidim harishonim, not your average Jewish person. How did this progress to a situation in which every Tom, Dick and Harry does this?
That is not my question. It is the question of the Magen Avraham, in Orach Chaim 494:
Thus, Magen Avraham asks why it spread to a custom/practice of rov halomdim. Note halomdim, and not all of klal Yisrael, I think. His answer is quasi-midrashic and quasi-kabbalistic -- that it is a tikkun for the Israelites going to sleep and Hashem having to wake them up for mattan Torah. And Magen Avraham's explanation has almost supplanted any Zohar-based explanation.
I doubt that Magen Avraham is correct in this. We have a clear source and explanation for the practice in the Zohar, which precedes Magen Avraham. Why did the practice spread? Not because of some tikkun. If so, why wouldn't it have been established as such even during the time of the chassidim harishonim? Rather, it is for the same reason that thousands of Jews said the tefillah of the Shelah Hakadosh the other day, or why they say Parashas HaMon on a specific Tuesday, even if they are not chassidim. The kabbalistic practice had elements of it to recommend itself, and so other, non-kabbalists, adopted the practice, organically.
I also don't think we should take the Magen Avraham's ex post facto explanation of the spread of the custom to be a basis for requiring this as normative behavior. (Though that a minhag has spread to become normative behavior -- even to non-lomdim -- may indeed have halachic implications. Then again, not everybody does stay up all night; not all those who do, really learn; and those who do suffer negative effects in terms of other aspects of Yom Tov, so there is what to discuss.)