Bettelheim notes that the antagonist or villain in fairy tales is used to present a challenge or danger. In the end, the villain is often cast away, signifying the child's growth and maturity.
The Uses of Enchantment: The Meaning and Importance of Fairy Tales