Character Analysis
(Click the character infographic to download.)
Hagrid is the groundskeeper at Hogwarts. He was expelled from Hogwarts when he was a boy, so he is technically not permitted to do magic, but Harry strongly suspects that the pieces of Hagrid's snapped wand are in a pink umbrella he keeps in his cottage.
Hagrid is deeply loyal to both Professor Dumbledore and Harry. When Hagrid thinks that Harry is about to be accused of Petrifying students, he storms into Professor Dumbledore's office and swears, "it can't've bin him, I'll swear it in front o' the Ministry o' Magic if I have to" (12.25). When Lucius Malfoy arrives to dismiss Professor Dumbledore as Headmaster of Hogwarts, Hagrid shouts, "Yeh can' take Dumbledore! […] Take him away, an' the Muggle-borns won' stand a chance! There'll be killin' next!" (14.132).
In fact, Hagrid's loyalty is one of his primary distinguishing features (besides his huge height). He loves creatures, anything from his large dog Fang to the giant spider he raised from an egg, Aragog. In fact, it was his loyalty to Aragog that got him expelled in the first place: Hagrid was caught trying to get Aragog out of the castle after a Muggle-born girl had been killed by the Chamber of Secrets monster. The circumstantial evidence points straight at Aragog as the killer and Hagrid as the Heir of Slytherin. Hagrid has no way to prove his innocence.
Later on, when Tom Riddle gloats over framing Hagrid fifty years before, he tells Harry:
It was my word against Hagrid's, Harry. Well, you can imagine how it looked to old Armando Dippet. On the one hand, Tom Riddle, poor but brilliant, parentless but so brave, school prefect, model student…on the other hand, big, blundering Hagrid, in trouble every other week, trying to raise werewolf cubs under his bed, sneaking off to the Forbidden Forest to wrestle trolls…but I admit, even I was surprised at how well the plan worked. (17.55)
In other words, Hagrid's kindliness and love of magical creatures is precisely what prejudices Headmaster Dippet against him. Hagrid is clumsy and unpolished. He can never compare to someone slick and charming like Tom Riddle. Hagrid continues to pay the price for his Headmaster's prejudice today, when his earlier expulsion from Hogwarts gives Minister Cornelius Fudge grounds to lock Hagrid in Azkaban prison so that Fudge can look like he's doing something to stop the attacks at Hogwarts. Hagrid comes in for a lot of prejudice and bigotry because he looks like the opposite of smooth pureblood wizards like Lucius Malfoy. Even if Hagrid doesn't have the social airs and graces of "respectable" wizards and witches, though, he's still one of the nicest and most lovable characters in the whole Harry Potter series.
Aside from Hagrid's presence as a support for Harry and a generally nice guy, he's also important in Book 2 because he provides two key clues for the identity of the monster in the Chamber of Secrets. He's the one who finds the dead school roosters and he also tells Harry and Ron to follow the spiders. Hermione uses these clues to identify the basilisk in her research before she is Petrified: "Spiders flee before the Basilisk, for it is their mortal enemy, and the Basilisk flees only from the crowing of the rooster, which is fatal to it" (16.72).