The pessukim mention that Shechem took Dina forcefully and Shimon and Levi killed out Shechem and the entire city, taking their children and wives as captives and their possessions for booty. Why indeed did Shimon and Levi kill the entire city, since only Shechem sinned by taking Dina?
The Rambam explains that the Bnei Noach are commanded on דינים, laws, which includes setting up courts in each and every city to judge their six mitzvos. If a non-Jew transgresses these mitzvos he will be killed with the death penalty. Also, if people see another transgressing and they do not judge him, they too are deserving of the death penalty. This is what happened with Shechem; the entire city saw and knew that Shechem stole Dina, yet they did not judge him, and therefore they too were deserving of being killed.
The Ramban is bothered: If this is so, Yaakov should have been the first to kill out the city of Shechem. And if he was afraid, why should he be upset that his sons were mighty and had the courage to battle a whole city? Rather, Shimon and Levi killed out the city of Shechem because they were all resha’im and they wanted to take revenge.
The passuk states that Yaakov says to Shimon and Levi, עכרתם אותי which Rashi explains means, you have dirtied the situation. Yaakov was disturbed because he was afraid that now the Cana’anim would come and fight against them. There is another reason mentioned by the birchas Yaakov: Onkelos translates that Shimon and Levi are mighty warriors who acted with might in the land of their settling, in Shechem. It was because of their anger that they killed Shechem and smashed down the wall of the enemy, uprooting an entire city. Therefore Yaakov cursed their anger and their wrath. The Ramban explains that Yaakov was disturbed with Shimon and Levi for killing out an entire city whose residents did nothing wrong. They came into a covenant with the sons of Yaakov and circumcised themselves. There was a chance that the entire city might return to Hashem and become part of the household of Avraham. Yaakov was also disturbed with a chillul Hashem, people would say that it was his advice. This is as Onkelos translates that Yaakov said he was not included in their secret plot to kill out Shechem, and he did not join with them to fight the battle. Although Shimon and Levi had the right to kill out Shechem (the leader) for stealing Dina, they had no right to kill out the entire city. Their anger and wrath caused them to go overboard beyond what was proper.
May Hashem help us always keep in control, and only exercise the minimal anger necessary to work out the situation.