Belief in fairies stems all the way back to Ancient Greek mythology. Only back then, they were similar to nymphs, satyrs, sileni, and even river gods. These beings can be classified as fairies because they were spirits whose main roles were to care for nature. Nymphs are recognized as nature deities, and there were believed to be nymphs for every aspect of nature: sky, sea, land, wood, and even the underworld. Satyrs were believed to be Pan's helpers, the god of the wild, and therefore cared for nature. Likewise silenis were considered to be woodland deities. As a student of the classics, Shakespeare would have learned his initial understanding of fairy mythology from Ancient Greek mythology, but his idea of fairies would have also been influenced by his own culture.
Norse and Celtic mythology developed turned the belief in nature deities into a belief in fairies, although their beliefs were significantly different from Shakespeare's descriptions. The Irish believed in the Tuatha De Danann, the first people of Ireland, who were actually fairies. The Tuatha De Danann looked like humans but had the ability to change shape. It has been pointed out that the Elizabethan belief in fairies stems from this Celtic belief ("The World of Fairies in A Midsummer Night's Dream and Elizabethan England"). The Elizabethan's believed that fairies were the same size as short human beings, and they were actually believed to be devilish. If humans respected fairies, it was believed that fairies would "cure diseases, bring an abundance of food..., clean houses, protect, bring fortune, and tell the future" ("The World of Fairies"). But if human's crossed the fairies, the fairies would play foul pranks.
Shakespeare's version of fairies departs significantly from the traditional Elizabethan beliefs. In fact, he created the view of fairy mythology that we hold today. Shakespeare portrayed them as small beings with wings, like Puck, who can fly at very rapid speeds. We see one example of Puck's speed when he promises to circle about the earth in 40 minutes in search of the love-in-idleness flower, as we see in his lines, "I'll put a girdle round about the earth / In forty minutes" (II.i.178-179). Also, while Shakespeare portrays Puck as mischievous, he also portrays the fairies as being benevolent towards humans. Oberon is especially portrayed as benevolent because he sincerely wants to help Helena with her love problems.
Therefore, Shakespeare's idea of fairies stems from very ancient mythology, but he actually created his very own version of the myth that has influenced fairy mythology ever.