I'm not a Hebrew scholar, but the meaning of the passage hinges on Ham seeing "the nakedness of his father", which apparently does not mean seeing Noah's naked body, but having sex with Noah's wife.
When it came to sex, sometimes the ancient Hebrew language had some nuances and idioms to work through. For example, when Adam had sex with Eve, the literal word used was that he "knew" his wife (Gen 4:1). And to differentiate the sexes, men were literally referred to as ones who "urinated against a wall" (1Sam 25:22). Since a husband was the only man morally allowed to see the nakedness of his wife, he sort of possessed or owned her nakedness, so in that sense, seeing her naked was "seeing the husband's nakedness". And "seeing" in that context was having with sex.
Therefore what happened was that Ham illicitly impregnated his own mother or step mother (Noah's wife*) who later gave birth to Ham, probably in some sort of attempt to take over Noah's Patriarchy. And Noah, through divine revelation, cursed Ham. The following vid goes into more details.
https://www.youtube.com/watch?v=h84rRWfY4A8&ab_channel=JustScriptureMinistries
*Shem, Ham and Japeth may not have been the offspring of Noah's current wife at the time. Their mother could have died, and he remarried. If so, Ham having sex with her wouldn't have been seen as much as gross incest. Such as situation is probably what Paul described in 1Cor 5:1 where the term "mother" isn't used, but rather "father's wife".