According to the story that appears in Sefer Bamidbar (Chapter 25), at the moment when the Children of Israel engaged in sexual licentiousness combined with idol worship, it was the action of Pinhas the son of Elazar whose father was Aharon, the High Priest that saved the Jewish people from destruction. Pinhas stepped forward and killed Zimri ben Salu, one of the heads of the tribe of Shimon, together with the Midianite woman with whom he sinned. As a reward, Pinhas received a covenant of priesthood (Bamidbar 25:11-14).
It appears that although Aharon and his sons were anointed as priests (see Sefer Vayikra Chapter 8), Aharon’s son’s children who were alive at that time were not included in that ceremony. In the Gemara on today’s daf (=page) we find that Rabbi Elazar quotes Rabbi Hanina as teaching that although he was from the priestly line, Pinhas did not become a kohen until after the incident mentioned above. Rav Ashi taught that it did not happen until many years later when the Children of Israel entered the land of Israel and Pinhas played a central role in bringing peace to the warring tribes (see Sefer Yehoshua 22:30-34). It is only then that we find that the biblical text refers to him as Pinhas haKohen – Pinhas the priest.
The Gemara continues and asks how the passage in Sefer Bamidbar that promises Pinhas a covenant of priesthood should be understood according to this opinion, and explains that it might be understood simply as a blessing. Rashiexplains that this means that it was a blessing for the future. Rabbenu Tam, who was apparently uncomfortable with the idea that God would have blessed Pinhas with status that could not be implemented, explains that from the time of the story in Sefer Bamidbar Pinhas could have claimed the priesthood, and, in fact, began to keep the laws of priesthood. Nevertheless, the people who blamed him for the death of one of the leaders of the tribe of Shimon did not allow him to be anointed to serve in the Temple until he succeeded in establishing peace among the tribes in Sefer Yehoshua.