Is it plagiarism when copying something that you have written before?
Plagiarism and self-plagiarism sound similar, but are importantly distinct things.

Plagiarism is if you use other people's work as your own. You deprive them of credit and claim credit for yourself which you do not deserve.

Self-Plagiarism does not deprive the author (you) from credit, but the offence here is that the the "present-you" claims credit that the "past-you" already collected.

This is an assessment offence because you would get a double mark for a single piece of work. You could, of course, quote yourself (properly cited!), in which case, you would be perfectly fine, but you would only gain marks for new work done, which, in case of a full copy, would still be zero. However, in a sensible school policy it should not be punishable for plagiarism in the conventional sense, since it was you in the first place who wrote the text.

As a student, I have reused software libraries I wrote in other coursework, properly cited, of course. It would be a waste of time to redo mechanical work, and permitted me to get much further. With an essay, nothing stops you, of course, to build upon existing writing (properly cited) to develop your argument further.