Among the midrashim we find several opinions as to why Noach cursed K'naan. Here's a few:
- Hashem had already blessed Noach and his sons (9:1) and a curse cannot exist while the blessing stands. He thus could not curse Cham (the actual perpetrator) and cursed his grandson K'naan instead. (Bereshis Rabbah 36:11; R' Yehuda) [As to why K'naan instead of Cham's other sons, perhaps because K'naan was the "main" child of Cham. "חם אבי כנען". Or additionally, see Radak below.]
- K'naan heard about Noach's state and either sodomized him or castrated him. (Midrash cited in commentaries. Yet a similar midrash brought in Talmud Bavli Sanhedrin 70a brings the explanations that Cham was the one who sodomized and/or castrated Noach. Then Noach cursed K'naan in the spirit of "You prevented me from having a fourth child, thus I curse your fourth child".)
- K'naan was the one who originally saw Noach and told his father Cham about it. (Bereshis Rabbah 36:11; R' Nechemia)
R' Saadia Gaon interprets "ארור כנען" as "ארור אבי כנען" - "Cursed be the father of K'naan". [This interpretation is analyzed by Ibn Ezra in his commentary.]
Radak suggests that Noach's intention was to curse Cham and his descendants, but saw trough nevua that the curse would be fulfilled through the descendants of K'naan.
Ralbag believes that K'naan was the one who originally disrobed Noach while he was passed out.
Ibn Kaspi and Shadal suggest that Noach wanted to limit Cham's curse to only a portion of his descendants, and chose K'naan since he was Cham's most beloved child.
Abarbanel writes that K'naan was inseparable from his father; went wherever Cham went and did whatever he did, which is why in the act, he is referred to as "חם אבי כנען" in 9:22. Abarbanel reads the verse as: "Cham, the father of K'naan, saw the nakedness of his father, and he [K'naan] told his two brothers outside." (Although K'naan actually had three brothers, seems he only two were available.) Therefore, although Cham had saw Noach and neglected to act respectfully as Shem and Yefet did, he did not do anything actively wrong like K'naan did.