While he was in the service of Math fab Mathonwy, Lord of Gwynedd, Gwydion fab Dôn learned of a herd of magic swine in the possession of Pryderi, whose father had received them as a gift from Arawn. Gwydion fab Dôn told his master of the swine and promised to obtain them for him. He disguised himself as a bard and, in the company of eleven others all similarly disguised, travelled to Dyfed, where they were hospitably received by Pryderi.
Gwydion fab Dôn told Pryderi of his errand and promised to show him a fair exchange for the swine the very next morning. That night Gwydion fab Dôn secretly created, by magic, twelve magnificient stallions, twelve greyhounds with golden collars and twelve golden shields. Pryderi was shown the magically created animals and shields and, after consulting his lords, agreed to exchange. Gwydion fab Dôn made off quickly with the herd of swine, for he knew that after two days his spell would fail. When the enchantment wore off and Pryderi was left with nothing, he set off in his pursuit of Gwydion fab Dôn.
Math fab Mathonwy mustered an army against Pryderi and after two bloody battles agreed that Gwydion fab Dôn should meet Pryderi in single combat to settle the issue. However, thw whole issue of the herd of swine was nothing more than a smoke screen, invented by Gwydion fab Dôn to help his brother, Gilfaethwy, who had fallen for Math fab Mathonwy’s foot-holder, the virgin Goewin. While Math fab Mathonwy was absent fighting Pryderi, the two brothers abducted Goewin and took turns in ravishing her. Gwydion fab Dôn then met Pryderi at Maen Tyriawg, where he used his magic to overcome and kill Pryderi.
Although the acquisition of the swine should have placed Gwydion fab Dôn in high favour with Math fab Mathonwy, his behaviour towards Goewin led to him and brother being humiliated by a punishment in which they were, for three years, forced to live in the shape of animals, each carrying out the role of male and female, and each year mating and producing an offspring. At the end of the three-year period Math fab Mathonwy considered they had been humiliated enough and restored them to their human form.
The position of foot-holder, which had to be filled by a virgin, was still vacant, so Gwydion fab Dôn put forward his sister Arianrhod. However, during the rite to attest her virginity, two bundles dropped from her, for Arianrhod had been pregnant, and her time came during the test, which is referred to as stepping over the wand. The first was a golden-haired baby, who was named Dylan. Immediately reaching maturity, Dylan set off for the sea, whose attributes and nature he adopted, whereafter he was known as Dylan Eil Ton, or ‘Dylan Son of the Wave’. Some have suggested that this story was concocted to cover the drowning of the first baby in the sea.
Gwydion fab Dôn quickly snatched up and concealed the second baby in a chest. He subsequently adopted the boy, but four years later could not resist showing him to his mother. Embarrassed by the reminder of her shame, Arianrhod cursed the boy, saying that he should bear no name until she herself gave him one. Gwydion fab Dôn circumvented this curse by disguising himself and the boy and tricking Arianrhod into calling the boy Lleu Llaw Gyffes. Gwydion fab Dôn could not resist boasting to his sister on how he had tricked her. Furious, she cursed the boy for the second time, this time saying that he would not bear arms until she herself armed him. Again Gwydion fab Dôn found a way around the curse. Finally Arianrhod cursed Lleu Llaw Gyffes for a third time, saying that he would never have a mortal wife.
Gwydion fab Dôn and Math fab Mathonwy worked together to evade this third curse by making Lleu Llaw Gyffes a wife from the flowers of oak, broom and meadowsweet, whom they named Blodeuwedd, ‘Flower Face’. However, she was unfaithful to Lleu Llaw Gyffes with the hunter Gronw Bebyr, the lovers unsuccessfully trying to kill Lleu Llaw Gyffes. Gwydion fab Dôn found the wounded Lleu Llaw Gyffes and healed him before changing Blodeuwedd into an owl. Lleu Llaw Gyffes himself dealt with Gronw Bebyr.
Later tradition says that Gwydion fab Dôn was responsible for the magical creation of Taliesin, although in the Mabinogion Gwydion (possibly a Celtic smith god) simply appears as a shape-shifter, an obvious reference to his magical abilities.