There is another approach that can be taken regarding the death of Nadav and Avihu. Rather than seeing it as a punishment it can be regarded as a consequence. The difference is very subtle, but this perspective can give us a possible answer:
Rashi brings up Rabbi Ishmael's opinion that they died for having entered the sanctuary intoxicated by wine, but Rashi also mentions Rabbi Eliezer's opinion that they died for giving halchic decisions in front of their master Moshe. The connection between these two opinions is not obvious, but we can find the clue to their relationship with the following Gemarah: "Wine enters, secrets emerge" (Eruvin 65a)
Nadav and Avihu drank in a holy fashion, so much so that through their drinking wine (yain nichnas sod yotzeh), they were able to achieve a tremendous level of divine love and revelation, and that is why they were able to give halachic decisions in front of Moshe.
So why did they die? What was their mistake?
It is explained in Chassidus that there is a connection between the death of Nadav and Avihu, and the story of the Four who entered the pardes:
"The Talmud (Chagigah 14b) relates that four sages "entered" the sublime sphere called Pardes, "Orchard," but only Rabbi Akiva emerged spiritually and emotionally intact. In the words of the Talmud, "Rabbi Akiva entered in peace and left in peace." By describing the manner in which he entered [which does not seem to be pertinent to the story], the Talmud implies that his peaceful emergence was the result of his peaceful entrance. i.e. since his initial motivation for entering the Pardes was predicated on selflessness and the intention of "shov", his "ratzo"came to a positive conclusion." (Likutei Sichot vol. 3:990)
So Nadav and Avihu's intense desire to cling to the divine resulted in their death, calot haNefesh, through achieving such intense revelation of the Divine their bodies were not able to continue to keep functioning. And that was the consequence rather than the punishment that resulted in their death.
Nadav and Avihu's mistake was not taking into account God's desire, they wished to cling into the divine and transcend their physicality. But God desires that we learn Torah and perform Mitzvos, and to do that we need to be alive in a physical body.
For further reading and sources check: