Plagiarism and copyright infringement have some overlap but they're distinct. You can be guilty of plagiarism by taking something in the public domain and presenting it as your own work.
It's not settled law yet. Many jurisdictions seem inclined to assign no copyright at all to AI-generated works, like the United States and the European Union.
Now, whether it is ghostwriting is another matter.