Gwydion is a magician of considerable powers and great cunning. He is responsible for arranging for his king's handmaiden Goewin to be raped, and also uses illusion to steal Pryderi's pigs, and is punished for his crimes by being transformed into various animal shapes.
After this, Gwydion seems to reform and becomes the mentor for Llew Llaw Gyffes, helping the young man win the tokens of manhood from Aranrhod by using his cunning and his magic powers.