Symbolism, Imagery, Allegory
The robin who first appears to Mary and who turns out to be a close friend of Ben Weatherstaff and Dickon is like a gatekeeper to the garden. As long as he likes you, it's a pretty sure sign that you're a good person. Indeed, without this friendly robin, Mary would not have found the key to the garden: He leads her to it at the end of Chapter 7 by pecking and scratching at a hole where the key is half-buried under dirt.
Aside from the fact that the robin has a close personal relationship with the garden, he is also the first character with whom Mary has a real personal relationship. Oh, she meets Ben Weatherstaff and Martha first, but the robin is, in a way, more important. When Mary sees the robin chirping at her as she's skipping through the garden with her jumprope, her whole personality changes:
Mistress Mary forgot that she had ever been contrary in her life when he allowed her to draw closer and closer to him, and bend down and talk and try to make something like robin sounds. (7.52)
The robin's easy, unchallenging interest in Mary seems to undo all of her Mistress Mary stiffness and distance so that she can attempt to communicate with the robin in his own language. And once Mary shows that she can become real friends with another creature, the key to the Secret Garden appears to her, so the robin becomes the first step on Mary's road to a real social life and an active relationship with the natural world.
Still, while Mary and Dickon are real friends with the robin, the novel never forgets that the robin is a bird and not a human. Occasionally, the narrative slips into the robin's perspective, revealing that he likes the humans' gardening because "all sorts of delightful things to eat are turned up with the soil" (9.20). And when he begins nesting at the start of Chapter 25, the robin reflects on the importance of his Eggs.
But though the robin isn't human (obviously), his ability to make friends across species underlines the novel's larger message that humans are as much a part of the natural world as any other species. We may not be exactly the same as robins, but we still share a lot in common that can bond us together in common harmony.