The Gemara in מסכת סנהדרין 52a, gives its reason for the punishment to Nadav and Avihu.
The Gemara says the following: Moshe and Aharon were walking on the way with Nadav and Avihu behind them, and all of Israel were behind them. Nadav said to Avihu, “When will these two old men die so that you and I can lead the nation?” Hashem said to them, “We will see who will bury who!”
Many use this little story to emphasize that G-d is the ultimate One in charge. The plans we make, totally depend on Him and we must humbly accept what we are given.
However, the Maharsha uses very strong words to describe the effects of jealousy. Nadav and Avihu were guilty of being jealous of Moshe and Aharon and their Kavod. When the שר של גיהנום, the ministering angel of Gehennom, saw this and grit his teeth, and brought about their complete demise.
This explanation is a frightening warning of what awaits those who are consumed with jealousy. We must work extra hard to overcome this horrible negative trait of jealousy.