Lag Baomer is not mentioned in the Bavli, Yerushalmi, or any Medrashim. It is not mentioned in the Rambam either. The earliest source we have for Lag Baomer is from the later Rishonim. The Meiri (יבמות ס"ב) comments on the Gemara that describes how R' Akiva's students died between Pesach and עצרת that they stopped dying on Lag Baomer and therefore we don't fast or say hespedim on Lag Baomer. This idea is what is brought down in Shulchan Aruch.
The Pri Chadash asks why would we celebrate that they stopped dying? The Gemara says that all 24000 students died, the reason they stopped dying is that there were none left. Why is that cause for celebration? The question is better then any of the answers that I have seen.
The Chida based on this question says that we celebrate that R' Akiva took on his new talmidim on Lag Baomer when the old talmidim stopped dying. However, this is against the simple reading of the Gemara. The Gemara says that the world was desolate until R' Akiva started teaching new Talmidim. It sounds like there was a gap between the 2 groups of talmidim.
R' Chaim Vital gives a completely different reason for the celebration of Lag Baomer. He says that R' Shimon Bar Yochai died on Lag Baomer and therefroe we celebrate his yarhtzeit.
This is difficult for a number of reasons:
1. There is no earlier source that R' Shimon Bar Yochai died on Lag Baomer. R' Chaim Vital is the first to say this.
2. It says in Shulchan Aruch that the yahrtzeit of a tzaddik is supposed to be a fast day not a day of celebration. The shulchan aruch in סימן תק"פ lists off a whole bunch of fast days such as ז אדר (Moshe's death), the day of Miriam's death, the day of Yehoshua Bin Nun's death, etc. Therefore if R' Chaim Vital is right we should be fasting on Lag Baomer not celebrating.
The Chasam Sofer in his Teshuvos was very much against the idea of making Lag Baomer a Yom Tov. He writes:
How can there be a holiday for a day when no miracle occurred and isn't mentioned in the Mishna, Talmud, or any hint at all in the Tanach?
In recent years the pilgrimage to Meron has become a huge event. This year more then 500,000 people are expected. This is another clear sign that the Chassidim have won. Rashbi and Meron are kabbalastic traditions which the Chasidim have adopted, as we see from the Chasam Sofer the non-Chasidic world was against this. Yet, today the whole Charedi world is caught up in Meron and Rashbi.