One would be completely wrong.
AI is a tool that may make copyright violations more likely, but whether the output violates copyright is a property of the output, not how it was produced.
If you copy and paste leaked closed source code or if your AI produces it verbatim, you're in trouble either way. Change it up a bit and you're fine in practice in both cases.