If anything it's credit goes to the AI generator or the company that produced the AI generator, not the person who asked it to create something. Unless they only used it for a backbone and then adjusted and detailed it from there.
Your example doesn't really fit the scenario proposed by @CyanFen@Lemmy.one. You're conflating multiple things. (Lots of people in this thread are)
Getting credit for the GPT essay, is unrelated to getting credit for completing the assignment.
In your example. The student would not get credit for completing the assignment. However they would get credit for creating the GPT generated essay. OpenAI does not.
If the assignment was to create a still life drawing, and the student turned in a photo. They get credit for the photo, not Canon who made the camera. The only issue is that the photo isn't a drawing, so they don't get credit for doing the assignment.