In Yaakov's blessings to his children, he says the following to Shimon and Levi:
Bereishis 49:6:
בְּסֹדָם֙ אַל־תָּבֹ֣א נַפְשִׁ֔י בִּקְהָלָ֖ם אַל־תֵּחַ֣ד כְּבֹדִ֑י כִּ֤י בְאַפָּם֙ הָ֣רְגוּ אִ֔ישׁ וּבִרְצֹנָ֖ם עִקְּרוּ־שֽׁוֹר
In their secrets may my soul not come; in their congregation my my honor not be singled out. For in their anger, they killed a man, and in their whim, they maimed an ox.
Explains Rashi:
בסדם אל תבא נפשי - זה מעשה זמרי [...] אל יזכר שמי בדבר - ״זמרי בן סלוא נשיא בית אב לשמעני״ ולא כתב בן יעקב. בקהלם - כשיקהיל קרח, שהוא משבטו של לוי, את כל העדה על משה ועל אהרן, אל תחד כבודי שם, אל יתיחד עמהם שמי, שנאמר, ״קרח בן יצהר בן קהת בן לוי,״ ולא נאמר ״בן יעקב.״
In their secrets may my soul not come - this is the incident with Zimri [...] may my name not be remembered by this matter - "Zimri son of Salu, prince of the household of Shimon," and it doesn't say "son of Yaakov." In their congregation - when Korach, who is from the tribe of Levi, will congregate the assembly against Moshe and Aharon, may my honor not be singled out there; may my name not be associated with them, as it says, "Korach son of Yitzhar son of Kehas son of Levi," and it doesn't say "son of Yaakov."
So far, so good. The first half of the passuk refers to a descendant of each Shimon and Levi, who stirred up trouble for Klal Yisrael. Why does Yaakov not want to be associated with them? Because, as Rashi explains further,
כי באפם הרגו איש - אלו חמור ואנשי שכם, ואינן חשובין כלם אלא כאיש אחד [...] ופשוטו, אנשים הרבה קורא איש, כל אחד לעצמו, באפם הרגו כל איש שכעסו עליו [...] וברצונם עקרו שור - רצו לעקר את יוסף שנקרא שור, שנאמר ״בכור שורו הדר לו.״
For in their anger, they killed a man - these are Chamor and the people of Shechem, who were not considered any more important than a single person [...] Its simple explanation is many people are called "a man," each one individually; in their anger, they killed any man who angered him [...] and in their whim, they maimed an ox - they wanted to uproot Yosef, who is called an ox, as it says, "the firstborn ox is a glory to him."
What is the connection between these two parts of the passuk? Why does their annihilating the city of Shechem and wanting to kill Yosef lead to Zimri and Korach, and Yaakov's not wanting to associate his name with them?