If you use code or art generated by an AI that was regurgitating training data, you can be sued for copyright infringement.
The way that AI gets training data these days is... questionably ethical. It's all scraped off the web, because the people who make these AIs saw court precedent for things like Google Books being fair use and assumed it would apply to data mining[1]. Problem is, that does nothing for the people actually using the AI to generate what they thought were novel code sequences or images, because fair use is not transitive.
[0] This won't work in current Copilot because a) I'm misremembering the comment phrasing and b) they explicitly banned that input from generating that output.
[1] In the EU, this practice is explicitly legal