We have to investigate this happening of the death of Aarons sons, as we find in the Torah and in the writings of the sages different statements that would seem to contradict each other. As we see below in Parshat Shmini -
Now Aaron’s sons Nadab and Abihu each took his fire pan, put fire in it, and laid incense on it; and they offered before יהוה alien fire, which had not been commanded upon them.
And then right after it says the following, with Rashi commenting implying that either way we look at it, there was a sin involved-
And fire came forth from יהוה and consumed them; thus they died at the instance of יהוה.
ותצא אש AND THERE WENT OUT FIRE — Rabbi Eleizer said: the sons of Aaron died only because they gave decisions on religious matters in the presence of their teacher, Moses... Rabbi Ishmael said: they died because they entered the Sanctuary intoxicated by wine...
However, in light of the above, we can find in many places detailed description on how Holy the sons of Aaron were that they were on a greater and more exalted level than Moses and Aaron themselves! As seen detailed in a full verse below -
Then Moses said to Aaron, “This is what יהוה meant by saying: Through those near to Me I show Myself holy, And gain glory before all the people.”And Aaron was silent.
And the below Rashi brings this idea out -
בכבדי BY MY GLORY — for my Shechina shall rest there. A Midrashic comment is: Read not here בִּכְבוֹדִי “by My Glory”, but בִּכְבוּדַי, “through My honoured ones”...
So Moses says to Aaron - "Aaron my brother, I knew that according to my knowledge the house was filled with the Divine, and I thought that it must be from me or you, however, now I see that your sons are greater than me and you"
And we can continue to see from the sages how great these two sons were, so how is it possible we can suggest that they had any sin?
An even bigger wonder is what is taught in the Talmud -
וכבר היו משה ואהרן מהלכין בדרך ונדב ואביהוא מהלכין אחריהן וכל ישראל אחריהן אמר לו נדב לאביהוא אימתי ימותו שני זקנים הללו ואני ואתה ננהיג את הדור..
..Moses and Aaron were walking on their way, and Nadav and Avihu were walking behind them, and the entire Jewish people were walking behind them. Nadav said to Avihu: When will it happen that these two old men will die and you and I will lead the generation, as we are their heirs?..
This is just shocking, as how could such righteous people talk this way?
And there is what to say to clarify the matter, and we will preface that with a verse -
וַיֹּ֣אמֶר מֹשֶׁ֣ה אֶֽל־אַהֲרֹ֡ן וּלְאֶלְעָזָר֩ וּלְאִֽיתָמָ֨ר ׀ בָּנָ֜יו רָֽאשֵׁיכֶ֥ם אַל־תִּפְרָ֣עוּ ׀ וּבִגְדֵיכֶ֤ם לֹֽא־תִפְרֹ֙מוּ֙ וְלֹ֣א תָמֻ֔תוּ וְעַ֥ל כׇּל־הָעֵדָ֖ה יִקְצֹ֑ף וַאֲחֵיכֶם֙ כׇּל־בֵּ֣ית יִשְׂרָאֵ֔ל יִבְכּוּ֙ אֶת־הַשְּׂרֵפָ֔ה אֲשֶׁ֖ר שָׂרַ֥ף יְהֹוָֽה׃
And Moses said to Aaron and to his sons Eleazar and Ithamar, “Do not bare your heads and do not rend your clothes, lest you die and anger strike the whole community. But your kin, all the house of Israel, shall bewail the burning that יהוה has wrought.
On this verse the Yismach Moshe asks why does the verse here say that the burning that HaShem did uses the name of G-D that implies the attribute of Mercy, this verse should have used the name of G-D for divine justice and punishment, not kindness and love!
And I will explain with the help of Heaven, based on what's written in the writings of the Toldot Yaakov Yosef on the below verse -
The wording above 'Gash Halaah', Gash implies closeness, and Halaah implies distance, and so it's written there that such close proximity can actually nullify ones existence, which is not the same of proximity from a distance. And this matter is steeped very deeply in Holiness, that regarding coming to close to Holiness without a boundary is a very dangerous reality to be in, since someone can cease to exist. Since a persons soul has its roots within Holiness from above, and when it gets close to its Holy source, it desires to merge back and be nullified within its origins, and the danger here is that someones soul doesn't depart and simply disappear.
To better understand this there is an analogy of something leaving itself. If we place a small flame next to a great fire, instantaneously the smaller candle will join towards the bigger flame and it will cancel itself out as its own reality and it will be one fire and one great light. Similarly this is the same with a soul, which we know is also compared to as a flame -
The soul of man is the flame of the LORD Revealing all his inmost parts.
The soul is compared to a lit candle and if it gets too close to its source in holiness without any boundaries there is a danger that through this it will get nullified into its source and join the upper light and so it's incumbent upon us to have some sort of boundary when we get close to Holiness.
And on this thought process I said with the help of Heaven to explain the below teaching from the sages -
כׇּל הַגָּדוֹל מֵחֲבֵירוֹ — יִצְרוֹ גָּדוֹל הֵימֶנּוּ.
Anyone who is greater than another, his evil inclination is greater than his.
In light of this we have to understand how it could be possible that a righteous person is created with an evil inclination that rules over him more than other people, and that it's even bigger for him than others is a wonder! What did he do to deserve such a punishment that he was given such a large evil inclination more than a regular guy who is on the lower level than him. But based on what we just spoke about above this could actually make sense and we will preface by explaining this with an analogy. This can be seen in the breakdown of a watch which has a small wheel inside that spins fast to tell the time, however this wheel alone won't help the watch tell the proper time without having something to counteract its speed so a bigger wheel is put there next to it that helps slow down the smaller wheel, and it helps calibrate to give the proper time and through the force of the opposing wheel to the smaller one, the watch is complete and fully working to tell the proper time.
And now in our matter we can explain this to say a person is created with a spiritual part of him which is called the good inclination, and it is always drawn after doing the will of the Creator and the desire of his maker, HaShem. And he's attracted and drawn to run like a deer to cling to HaShem Yitbarach with all of his actions and all of his ways, just like that small wheel on the watch is moving so fast, however without that person having some type of opposing force to his spiritual drives to do God's will he won't be able to remain human. This is because of the desire and draw that he's going to have towards the divine - right away his soul will leave him like a small flame that attaches itself to a bigger flame of the divine infinite light may it be Blessed, and his existence will cease to be, and he wont be able to remain down here in this world to serve anymore.
So in order to upkeep the Creation, God had to also create physicality that acts as an opposing force and pulls us in a different direction, and it stands next to and against the spiritual part of us to block us from just going up too high back towards our source, and through this, these two forces work together to make us human, who can serve the Creator of the Universe in this world and upkeep the commandments, because the power of the physical acts as an opposing forces to our spiritual side, and creates a healthy boundary to allow us to stay down here in this world and continue to fulfill the Divine Will of the creation according to the reality of us having a soul and body merged into one.
So we see that only through having an evil inclination, which acts as the large wheel of the watch to be the opposing force to our spiritual side from going to high up. Through this, a person can maintain existence in this world. And with this we can fully understand what the sages of Israel taught regarding that the greater a man, the greater his evil inclination. Since he is greater than his friend, his spiritual side is greater, and he has a very great light within him, and because of this its incumbent to have a boundary for this light via an opposing force which manifests itself in him having a greater evil inclination. And the situation is that a human MUST have an evil inclination in parallel to greatness of his/her light in order to stay alive!
And in this school of thought we can explain - in truth Aarons sons, Nadav and Avihu were very great and lofty! And as Moshe told Aaron that his sons were greater than himself and Aaron, and that they are closer and more attached to HaShem on an elevated manner in an aspect of being nullified from existence before HaShem every single moment, and since they were on such an exalted level, as an aspect of 'greater than his friend', they were left with no option but to take an action to remain down here and not cease to exist from such a spiritual high. And they did what they did as we saw from the teaching of the sages of Israel. And this was an aspect of their evil inclination as we discussed, in order to pull them down to the other side, and through this, they were able to stay in this world and continue to serve HaShem.
However, they got to too high of an exalted level, therefor, even though they brought a foreign fire before HaShem, it didn't help them stay down here in this world, and this is why the verse above says - "They came close before HaShem and died", which we can see to mean is that they were already too close to HaShem Yitbarach, and they didn't have the strength even after their action to hold on to their bodies and remain down here.
And with this we can explain the words of the Sages of Israel who said above the story of Nadav and Avihu were walking behind Moses and Aaron and said when will these two elders die? And with what we established, we can see their intention was referring to the exalted level they were on, as they were feeling the massive flame within them until it came to the point when their soul was about to depart and leave their bodies due to being so high and returning to its source in the Blessed One - so therefor they wondered regarding Moshe and Aaron, and said then will they die? Meaning they figured how could these massive holy souls like Moshe and Aaron, who are greater than us, still be alive on the face of the Earth, and they aren't getting nullified from being so high!
And on this path we are establishing we can very well explain our question of the Yismach Moshe when the verse was using the name of HaShem that invokes divine mercy and compassion, when it seemingly should have been the name of justice. Yet, Aaron the Priest knew very well that there was no punishment going on here, rather he knew that their souls left by being spiritually consumed through them being too attached to the source of life, Blessed is His Name. They simply had no opposing force anymore to keep them here, and whatever they did to create an opposing force and stay down here didn't help them, and we see that they weren't punished, rather their psychical life-force was nullified due to their exalted spiritual level, just like a small flame that gets consumed up by a bigger fire next to it, and if this is all the case, there was no need for the name of Hashem invoking justice to be used here, rather the opposite, this was all done with mercy and kindness.
And with this we can understand the verse below -
Then Moses said to Aaron, “This is what יהוה meant by saying: Through those near to Me I show Myself holy, And gain glory before all the people.”And Aaron was silent.
The intention of this verse isn't to teach is that Aaron withheld from complaining about this decree, because that wouldn't add anything, and its of no exalted level to stay quiet when misfortune happens. Rather the opposite, as we see below!
חַיָּיב אָדָם לְבָרֵךְ עַל הָרָעָה כְּשֵׁם שֶׁמְּבָרֵךְ עַל הַטּוֹבָה
One is obligated to recite a blessing for the bad that befalls him just as he recites a blessing for the good that befalls him
So if this was a bad thing (his sons dying) there would be no room for Aaron to stay quiet! Rather the intention here is based on what we wrote, that Aaron knew they were on an exalted level, therefor he stayed silent because he knew vey well that there was no punishment or decree, rather their souls simply were consumed in their source in HaShem, and as Moshe of Blessed memory said to him, "Those close to me I will sanctify", that they simply got to too high of a level.