Robin Goodfellow is a trickster who plays pranks on the unsuspecting.
When we first meet Puck, a fairy points out that he is a trickster. He enjoys practical jokes. She calls him a “shrewd and knavish sprite” who tricks everyone from wanderers to sweet maidens. She points out, though, that he can be friendly to those who are friendly to him.
Those that Hobgoblin call you, and sweet Puck,(40)
You do their work, and they shall have good luck.
Are not you he? (2:1)
If you are nice to him, he might help you--until you fall out of his good graces!
Puck describes himself as a “merry wanderer of the night” and points out that his main job is to help Oberon, doing his bidding and making him laugh. Otherwise, he is a trickster of opportunity. He plays whatever prank comes to mind, such as pretending to be a three-legged stool and then getting out from under the person who tries to sit.
Puck plays a prank on Bottom, replacing his head with an ass’s. This is partly the reason that he wakes Titania and she falls in love with him, because the other craftsmen run away. Thus Puck’s tricks become a crucial part of the plot’s turning.
Shakespeare did not invent Robin Goodfellow. He was a character from English folklore. The play does seem to have increased his popularity though, and now he is mostly associated with Shakespeare’s portrayal.