Fairy tales are folk stories about magical events. Fairy tales were developed over many thousands of years and passed form one generation to another by word of mouth over fires of an evening. They were a way of helping to pass long nights when there was nothing else to do.
Some of the most famous early fairy tales that remain much as when they were first written down were written in Baghdad, in the Middle East during the 9th to 13th centuries. This was the Golden Age of Islam, when people in the House of Wisdom in Baghdad tried to write down all of the stories they could find from all over the world.
The fairy tales were gathered together under 'The Arabian nights'. They included the idea of a genie and many others. In later centuries these early tales were added to so that we now have stories like Aladdin and the lamp and Ali Baba and the 40 thieves within the collection.
More recently there have been many famous fairy take collections. One of these is by the Brothers Grimm, which was published as Grimm's fairy tales and includes such things as Hansel and Gretel. Many of these do not have happy endings. Later on Hans Christian Anderson produced another famous collection. And so they have gone on up to the present where H H Tolkien produced The Lord of the Rings and J K Rowling produced the Harry Potter series.
This link below takes you to a section with many traditional stories.