If I independently come up with a song called "Let it Be" that has the same lyrics as the Beatles song and publish it without the permission of the copyright holders, I will have violated their copyright.
It doesn't matter if I heard the song before or not. It doesn't matter if I did it myself or used a computer to do it. What matters is the final product and my publishing of a song close enough to the one that was copyrighted.
AI image generators are just tools, like Photoshop is a tool. Nobody cares if you used a paint brush or Photoshop to create something that looks like a copyrighted image, why should AI image generators be any different?
If the final image is similar enough to a copyrighted work and I publish that image without permission of the copyright holder, then that's a copyright violation.
If the final image is different enough, then it's not.
That an AI was used and how the AI was trained are completely separate issues.