After the two sons of Aharon were killed by Hashem, it says in Vayikra 10:6 “ And Moses said to Aaron and to Eleazar and to Ithamar, his sons: Do not leave your heads unshorn and do not rend your garments, so that you shall not die and lest He be angry with the entire community, but your brothers, the entire house of Israel, shall bewail the conflagration that the Lord has burned.”

Why were Aharon and his sons forbidden to show any sign of mourning, but Yisrael were instructed/encouraged to do so?

2 Answers
2

Aharon and his sons were involved in the sacrifices for the inauguration of the Mishkan, and were thus informed that their service had to override any public displays of mourning. (While they certainly grieved internally, they had to continue their service.)

Shortly before his death, Moshe blesses the tribe of Levi, describing "those who say to their parents 'I didn't see them', who don't recognize their brothers nor know their children." The Sforno explains this is describing the tremendous emotional sacrifice required of the Kohen Gadol, who is not allowed to attend the funerals of even his closest relatives.

Lord Sacks suggests that the Mishkan/Mikdash had to be so focused on life that we couldn't allow reminders of human death or deterioration there. (That's his suggestion for why a kohen with a physical deformation can't serve.)

The Mishnah in Berachos 9:5 teaches that a person is obligated to bless Hashem when something bad happens in the same
way that he blesses Hashem when something good happens, and Rava explains that the Mishnah means that he should accept the bad thing happily. But others should not should not similarly rejoice about a
person's misfortune, but on the contrary, they should be distressed by it.

This is what Moshe was saying to Aharon and his sons, that they should not show any signs of mourning but rather to accept their misfortune happily, but Yisrael should
be distressed by the death of Aharon's two sons, and they should mourn for them.