The story
Coined by J. K. Rowling in her 1997 book Harry Potter and the Philosopher's Stone. Rowling has speculated that she might have subconsciously produced the name from hogwort, a plant she saw when walking round Kew Gardens. Previously used by Geoffrey Willans in his 1953 book Down With Skool (which J. K. Rowling has read - see the article). Willans’ use was as the title of a fictitious play, “The Hogwarts”, referred to in the book as the creation of Marcus Plautus Molesworthus. In-universe, interpreted as a simple compound of hog + warts (cf. warthog).
Etymology from Wiktionary, CC BY-SA 4.0.