|Muggles' Guide to Harry Potter - Place|
|Location||Hogwarts school grounds, near the Forbidden Forest|
|Permanent Residents||Rubeus Hagrid and various "pets"|
|First Appearance||Harry Potter and the Philosopher's Stone|
As Keeper of the Keys and Grounds at Hogwarts, Rubeus Hagrid is required to live on the school grounds. Rather than living in the school proper, he has a separate "hut", a (possibly) one-room building where he lives, close by the Forbidden Forest, possibly to keep him closer to his specific area of responsibility.
Our first introduction to Hagrid's hut is at the end of Harry's first week at school, when Harry is invited to Hagrid's hut for tea. Ron joins him uninvited, and Hagrid welcomes him in. When Hermione joins the group, Hagrid accepts her as well, and the Trio start visiting Hagrid frequently. Many story points are illuminated by Hagrid, as he discusses affairs of the day with the Trio. And on occasion, Hagrid acts as intermediary between the Trio, when they become estranged for some reason.
Hagrid is fond of wild creatures, and spends significant time in the Forbidden Forest investigating them. He also has a tendency to keep some of them as pets. Apart from his massive boar-hound Fang, Hagrid has also found space in his hut at various times for Norbert, a baby dragon, and Buckbeak, a hippogriff.
Over the first six books of the series, Hagrid's hut becomes something of a refuge for the Trio, in a way that apartments inside the castle could never be. Being outside the castle walls, even though still on the grounds of the school, lends it an air of distance, of independence, which makes it easier to speak of things occurring inside the castle with less fear of having them break into the conversation. Additionally, Hagrid's remoteness from the castle makes it necessary on occasion for the Trio to describe what's happening. The author carefully avoids rehashing exposition, instead mixing reactions of the Trio with a one-line indication of what events are being discussed. This is, we note, a useful device for description of the thoughts of characters other than Harry; by explaining them to Hagrid, Ron and Hermione display inner thoughts to the reader that Harry may not have been able to sense.
While it is clearly a necessary story element, it is never mentioned why Hagrid chooses to live outside Hogwarts castle. Surely with the assistance of the house-elves tending to his every need, and with actual running water and indoor plumbing available, life in the castle would be more comfortable. He certainly takes a number of his meals there, despite having cooking facilities of a sort in his hut, and apparently at least minimal ability to cook. (The products of his kitchen are something of a running joke.) Against that, of course, we see that he would be somewhat isolated from his charges on the grounds and, later, in the Forbidden Forest, and additionally might find it tiresome to be dealing with things built to a smaller scale than he expects. It is possible, of course, that the hut is specifically provided for the groundskeeper's use; if so, it's possible that Hagrid rebuilt it to his own scale. However, we never hear anything of Hagrid's predecessor in that role (apart from his name, Ogg).