Most fairy tales come from popular tradition and there are as many versions as there are little old grandmas telling them. There are often local twists and flavours that reflect where the story was told. Perrault and the Grimm brothers collected these stories and often gave them a more polished spin, as did many others in the 19th century. Others, like Andersen, wrote more original tales based on traditional folk elements.
Italo Calvino has a fantastic collection of Italian fairytale (some of them are quite disturbing) and I rather enjoyed "Clever Maids", about how the Grim brothers collected their fairy tales (we think of his sources as the little grandmas I mentioned but his main sources were actually friends of their sister).