It would not need to be trained on CP. It would just need to know what human bodies can look like and what sex is.
AIs usually try not to allow certain content to be produced, but it seems people are always finding ways to work around those safeguards.
You can ask it to make an image of a man made of pizza. That doesn’t mean it was trained on images of that.
But it means that it was trained on people and on pizza. If it can produce CSAM, it means it had access to pictures of naked minors. Even if it wasn’t in a sexual context.
I think @deathbird@mander.xyz meant was the AI could be trained on what sex is and what children are at different points. Then a user request could put those two concepts together.
But as the replies I got show, there were multiple ways this could have got accomplished. All I know is AI needs to go to jail.