In typical, laconic Biblical style we get a lot of action, but not a lot of details explaining why these two young men were killed when offering incense to God. In contemporary Jewish life, we are so thrilled when young Jews want to be involved that we could not imagine punishing them for worshiping God in their own creative way.
However, at least in the Bible, we know from the earliest times of Cain and Abel, that God does not accept all sacrifices equally. Indeed, more than once are people killed in the Bible for offering inappropriate sacrifices. Due to the lack of detail in the Biblical narrative, a variety of commentators have offered reasons for why these two men were liable for death. Most commentators accuse them of egotism: offering strange fire instead of following the advice and instruction of their father. Some commentators assume that they came into the sanctuary drunk, an act prohibited for priests by the Torah. One midrash claims that they were not dressed appropriately for the occasion.
There is one commentary, however, that claims that their intentions were righteous, but misguided. The Or Ha-Hayyim "sees them as motivated by excessive piety. Out of their love for the divine, they tried to come too close to God who is like a raging fire." (Translation by Etz Hayim Torah Commentary) After approaching God with too much zeal, they were consumed by the Divine's Presence.
Sometimes our intentions matter, but sometimes they do not matter or do not matter enough. We are judged on the results of our actions and not their justifications. Whether Nadab and Abihu were compelled by malice, arrogance, apathy, or religiosity, they offered an inappropriate sacrifice and were punished for their transgressions.
As human beings in the world we always need to make sure that our best intentions lead to the best results through care, consideration, and consultation. This is the ultimate path of holiness and a functional society.