And a fire went out from before Hashem and consumed them (10:2)
The Gemora explains that Nadav and Avihu deserved to die because they were once walking behind Moshe and Aharon, when Nadav turned to his brother Avihu and said, “When will these two old people die so that me and you will lead the generation?”
This account is very perplexing; how could the sons and Aharon look forward to their father’s and uncle’s death? Furthermore, Nadav and Avihu were themselves giants in Torah and the most suitable candidates to take over from Moshe and Aharon as the leaders of the Jewish People if they would have lived. Were these great people so conceited that they could not wait until they had become the leaders of the generation?
Rav Yosef Salant answers that of course we cannot say such things about such great people, whose level of greatness we cannot come close to understanding. The reason why Nadav and Avihu were thinking such thoughts was solely in their deep desire to come close to Hashem in a way that was not possible unless they were leading the generation. This is because they knew that the leader of a generation is only given as much greatness as the generation is worthy of. At the same time, they knew that only this generation would reach such a lofty level of holiness and appreciation of Hashem, unparalleled until Moshiach arrives. Therefore, it was only through the greatness of that generation would Nadav and Avihu be capable of reaching the highest level of connection with Hashem. It is for this reason that they expressed a desire to lead the generation while the generation was still on a high level of holiness.
However, now that we see that their intentions were only positive and geared towards holiness, we must ask, why were they punished?
Rav Yosef Salant answers that that on their level of greatness, such thoughts were inappropriate.
We can take this idea further and suggest that such thoughts of personal greatness at the expense of others is not a character trait of a true Torah leader. In fact, we see quite the opposite from Torah leaders throughout the generations who give up so much time and energy for others when they could be sitting in the Beis Medrash probing the depths of Torah and developing a deeper appreciation and connection with Hashem. Therefore, we can suggest that since Nadav and Avihu demonstrated that they did not possess this character trait to the extent was required of the next leaders of the generation they were prevented from inheriting the leadership from Moshe and Aharon.