In 25:14 the Torah tells us the name of the man who had committed the public act of indecency with a Midianite woman. Until now, when relating the incident, the Torah did not tell us who he was. It simply described him as a "Jewish man".
Rashi tells us that because it just told us who was the tzaddik - Pinchas - so it also tells us who was the rasha.
But at the end of Parshat Balak when it related the main part of the story it also related there who the tzaddik was, yet regarding the rasha it did not tell us his name, it called him a Jewish man without actually identifying him. Why not then but now yes?
Earlier, at the end of Parshat Balak, the Torah was relating the story of what happened. If at that time, as the story is happening, the Torah would tell us his name, we would see how important a person he was and what he was doing, it would give people an opportunity to "learn from him".
If, for example, you would see a Rabbi eating in a certain restaurant that you thought was questionable, you would probably say, "Oh, the Rabbi must have checked it out and found it to be ok. if he can eat there, I for sure can."
You see an important person, a leader, doing something that might be questionable ethically or morally, and you automatically say that if he is doing it it must be ok.
If we would have read the story knowing from the start that the offender was Zimri the Nassi, we would rationalize in our minds that what he was doing must have been ok. We would likely learn from him.
When it relates the story, it only tells us "a Jewish man", so we will not learn from him and follow in his ways. He is just a Jew who did something wrong. nothing special.
Now, in Parshat Pinchas, when it is validating the vengeance of Pinchas, it is ok, and even beneficial, to tell us who the offender was. Now that he has been punished, and Pinchas is being glorified for having meted out the punishment, nobody will take example from him. The risk has been negated. On the contrary, by saying his name now, people will see that even great people make mistakes, and they get punished for them. They do not have protexia from being punished.