The difficulty in understanding this account is purely grammatical.
We read about this account in Genesis 9:18-25: “Now the sons of Noah who went out from the ark were Shem, Ham, and Japheth. And Ham was the father of Canaan. These three were the sons of Noah, and from these the whole earth was populated. And Noah began to be a farmer, and he planted a vineyard. Then he drank of the wine and was drunk, and became uncovered in his tent. And Ham, the father of Canaan, saw the nakedness of this father, and told his two brothers outside. But Shem and Japheth took a garment, laid it on both their shoulders, and went backward and covered the nakedness of their father. Their faces were turned away, and they did not see their father’s nakedness. So Noah awoke from his wine, and knew what his [Ham’s] younger son [some Bible translations have “youngest son”] had done to him. Then he said: ‘Cursed be Canaan; a servant of servants he shall be to his brethren.’”
Notice that Canaan is mentioned twice in the account. The pronoun “his” properly refers back to Ham, not Noah. Genesis 10:6 shows that Canaan was the “youngest son” of Ham: “The sons of Ham were Cush, Mizraim, Put, and Canaan.” Canaan is mentioned last in time order of birth.
Canaan was not punished for a sin that Ham committed. He was punished for his own sin!