No, it is not illegal to use artificial intelligence to write an essay, as these essays are plagiarism-free. On the contrary, it can be very helpful and beneficial as AI can provide you with new ideas and a good reference to begin with, and it will save you time while improving your skills.