Rashi in no less than four places addresses himself to the reason(s) behind the death of Nadav and Avihu. each time offering a different explanation, each with its own set of difficulties:
1) Our parsha (Shmini) says that Nadav and Avihu were guilty of offering an "aish zarah." Rashi (10:2) quotes two interpretations in Chazal as to exactly what they did wrong: R' Eliezer explains that they were guilty of paskening halacha without consulting or deferring to Moshe; R' Yishmael explains that they entered the Mikdash while drunk. It's not clear why Rashi needed these added explanations when the pshuto shel mikra of what was done seems clear.
2) In Shmos 24:9 Rashi explains that at the moment of mattan Torah Nadav and Avihu gazed at G-d's presence is a haughty way, while indulging in food and drink, and were therefore deserving of death. Rather than disturb the joy of that moment, Hashem delayed their punishment until the chanukas hamishkan. If Nadav and Avihu deserved death for what occurred at mattan Torah, why does Rashi in our parsha offer those other explanations for their guilt?
3) In Devarim 9:20 Rashi explains that Moshe's tefilah on behalf of Aharon for his sin of making the eigel was only partially accepted: two of Aharon's four sons were spared, but two were meted out the death penalty. It seems from this Rashi that the death of Nadav and Avihu was a punishment not for their own crimes, but rather for Aharon's. Aside from the problem of why we need yet another explanation for Nadav and Avihu's death, this explanation itself raises the troubling philosophical/ethical question of whether children deserve to suffer punishment for the sins of a parent.
4) Finally, Rashi in our parsha (10:3) writes that Moshe consoled Aharon upon the death of Nadav and Avihu by telling him that it is now clear what Hashem had in mind when he said, "V'nikdash b'kvodi" (Shmos 29:43), that the Mikdash will be sanctified through the death of His honored servants. The fact that Nadav and Avihu were the ones chosen for this fate proves that they held a place of honor in G-d's eyes. This reason for Nadav and Avihu's death seems unrelated to any wrongdoing on their part, quite at odds with Rashi's other explanations. We are also left to wonder how death can be meted out to an undeserving victim simply to serve some end, even a noble end like sanctification of the Mishkan.
I'll leave it to you to work out answers (or look in the meforshei Rashi). Two points that should help: 1) There is no rule that says that an event cannot be overdetermined; 2) A theoretical liability for punishment may require some trigger to actually bring it to bear in reality.
There is one other point I want to deal with. As we mentioned above, according to Rashi Shmos 24:9 the punishment due Nadav and Avihu was incurred at mattan Torah and was delayed so as to not interfere with the simcha of that day. So why interfere with the simcha of chanukas haMishkan? Why did that punishment have to be carried out now?
R' Raphael Sorotzkin offers an answer that I think is already found in Maharal in Gur Arye. The sin of offering an "aish zarah" done by Nadav and Avihu during the chanukas haMishkan stemmed directly from their behavior during mattan Torah. Aveirah goreres aveirah -- an aveirah may either give rise to or be a symptom of a deeper flaw in character or attitude, which, if not eradicated, will eventually sprout other aveiros (see Rav Hartman's notes to the Gur Aryeh). There was obviously something lacking in Nadav and Avihu's reaction to that closeness with Hashem experienced at Har Sinai which led them to intrude on the moment with food and drink. That exact same shortcoming is what led them to intrude into Hashem's presence in the Mishkan with their own uncalled for offering. The day of chanukas haMishkan was not arbitrarily chosen as the day to mete out punishment for the earlier crime. It was chosen because Nadav and Avihu's actions on that day shared a common denominator with their earlier sin. Punishment deferred the first time around was not passed over the second.
How could such great people have made such an error? I think the answer is based on the halacha that says even though eating is normally prohibited in shul, an exception is made for for talmidei chachamim who are there all day (Meg 28). You and I go home from shul to have breakfast and lunch, but for the talmid chacham, the shul is home.
Precisely because Nadav and Avihu were on such a high spiritual plane they took liberties that you and I might not have. They basked in the presence of the Shechina and did not want to leave Har Sinai for one moment. It became their home, a place that brought food and drink into not out of gluttony, but simply because they could not bear to leave. Whatever the "aish zarah" was, the idea I think is that Nadav and Avihu brought more of themselves into the Mishkan than you or I might have because they wanted to be as immersed in the place as possible.
It was not a sin of gross misconduct that led to their being punished -- the thoughts Nadav and Avihu had were obviously far from mundane. It must be that on some level something in their conduct or attitude, something you or I would consider a trifle, was off just enough to warrant punishment for people on their level who are judged by a more exacting standard. I think perhaps the punishment was meted out here because the chanukah, the initiation of the Mishkan, must be done perfectly (see R' Yosef Engel in Gilyonei HaShas, Shabbos 23), without cutting corners. At least the first time something is done, it should be done right. Even if their offering might have been overlooked at some other time, on this day, the "grand opening" of the Mishkan, it was completely out of place.