"I haven't introduced meself. Rubeus Hagrid, Keeper of Keys and Grounds at Hogwarts."
-- Rubeus Hagrid (PS4)
When Hagrid comes to get Harry in Hut-On-Rock, he says he is the Keeper of the Keys, which means that he has a large ring of keys which can lock or unlock any door on the Hogwarts grounds (PS4). Presumably Filch has a simliar set of keys, but only for doors inside the castle proper. Hagrid controls entrance to the grounds and to the buildings. Perhaps he would also be called the gatekeeper–his hut is fairly near the front gate judging by the sequence of events during the battle at the end of book six.
In addition to being entrusted with Harry’s safety, Hagrid also has the key to Dumbledore’s vault at Gringotts (number 713) where the Philosopher’s Stone is kept, which shows how much he is trusted (PS5).
Figuratively speaking, Hagrid here holds the keys to Harry’s entry into the Wizarding World. When he breaks down the door into the hut on the rock, he bursts through into the Muggle world and opens the way for Harry to enter the Wizarding World and to find his true identity.
Before Hagrid, there was another gamekeeper named Ogg:
“Harry had a very enjoyable morning walking over the sunny grounds with Bill and Mrs. Weasley, showing them the Beauxbatons carriage and the Durmstrang ship. Mrs. Weasley was intrigued by the Whomping Willow, which had been planted after she had left school, and reminisced at length about the gamekeeper before Hagrid, a man called Ogg” (GF31).
From what Hagrid does in the books, it can be assumed that the Keeper of the Keys does these things on the job:
- Keeper/protector of the keys
- Look after the grounds and creatures on the grounds
- Bring in pumpkins for the Halloween Feast
- Bring in the Hogwarts Christmas trees
- Escort the first years from the Hogwarts Express to Hogwarts School of Witchcraft and Wizardry via boat
Hagrid is only called Keeper of the Keys in Book One, and after that is referred to as the "Gamekeeper," one who looks after the creatures in the Forbidden Forest, as well as farm animals.
J.K. Rowling said it's not a title of great importance to the story:
Question: Hagrid’s Keeper of the Keys title: does that mean anything?
JKR: Just simply that he will let you in and out of Hogwarts, so it’s slightly more interesting than that but it’s not loads more interesting. So, again, that is something that people shouldn’t get too excited about. (TLC)