Here's why:
* Hunting: Hagrid is a gamekeeper, and in the book, he's using the shotgun to hunt a giant spider that's been terrorizing students. This is due to his own giant heritage making him more comfortable around large creatures.
* Protection: The shotgun also serves as a means of protection. As a half-giant, he's often seen as a threat, and the shotgun might make him feel safer.
* Symbolism: The shotgun is a symbol of Hagrid's duality. He's a gentle giant, but he also has a wild and dangerous side. The shotgun represents this dangerous aspect of his personality.
It's important to note that crossbows are not mentioned in the book as part of Hagrid's arsenal.