The Mabinogion is a large (for its time) collection of myths/legends from Celtic Wales bundled together with some Arthurian tales and reasonably translated into English by Lady Charlotte Guest in the 19th C. But they were translations of a more archaic pair of texts (The Red Book of Hergest, The White Book of Rhyddyrch) which were from the 12th C and which captured in writing much, much older stories that had been shared across the country via oral tradition.
There are three dragon-related tales in ‘The Mabinogion’.
One such tale (found in the Red Book of Hergest) is believed to be the oldest account of Welsh dragons and, itself, probably descended from a much older continental Celtic tale.
The Story of Lludd and Llevelys has one ancient Chieftain of Briton discuss with his brother (a Chieftain across the sea in Gaul) for help with a number of plagues affecting his kingdom. One of these turns out to be caused by two dragons (a local one and a foreign one) battling; they give such a fearsome sound every May Day (Beltaine) that pregnant women all over the country miscarry. To rid his country of them, he must imprison them beneath the earth at the exact centre of the island of Britain. To do this he lures them there, gets them drunk on mead and then traps the incapacitated dragons deep below the earth. The dragons are just one challenge of three in the story (Celts loved threes) and each is resolved by a combination of the wisdom of one brother and the courage and cunning of another. The story gives us a valuable insight into the traits that were desirable for the earliest peoples of Britain.
(It’s hard not to note that there is no warring in this story. All three challenges are resolved by clever brain work, not might, though either king was certainly warrior enough to accomplish the task.)
Another tale in The Mabinogion is believed to be a variant of the much older Lludd and Llevelys or even a sequel, if you like. In its first inception it included no Arthurian characters at all but, later, was modified to include Merlin, a character that, later, became integral part of the Arthurian pantheon.
In the story of Vortigern, this (disgraced) High King of Britain seeks to build a stronghold in the mountains of North Wales (a distant corner of his Kingdom which was all of Britain) to protect him from both his vengeful people (furious that Vortigern led to the invasion of the Saxons) and from the faithless Saxons who came at his invitation to fight for the Britons and then flipped teams and took over the country. But every time he tries to build walls they crumble. His wisemen tell him he has to sacrifice a boy with no father and soak the foundations in his blood. The search goes out, such a boy is found, and brought before Vortigern.
But the boy is clever (again, see the praising of wit over valour?) and a seer and he reveals to Vortigern two ancient dragons (red and white, just as in the earlier story) fighting beneath his foundations and disturbing them. Releasing them, he says, will mean he can build his stronghold uninterrupted. The dragons are found in an underwater reservoir, released, and free to go back to their battling. The boy goes on to become Vortigern’s heir for the stronghold and gets it much sooner than anyone expected. The earliest tales call this boy Ambrosius (which, in Welsh, is Emrys) and, to this day, the mount on which the stronghold is believed to stand is called Dinas Emrys—or Emrys’ Stronghold—a name that has endured one-and-a-half millennia.
The third dragon in The Mabinogion appears only briefly in the story of Peredur (Son of Evrawc)—which is one of many in which various adventures suffered by the protagonist are grouped together in long sequences presumably to aid in the retelling by bards and the comprehension by listeners—but it gives us a few themes that are most common to the modern reader.
This dragon is of the archetype most familiar to modern readers (see my post on Tolkien), the dragon who greedily hoards wealth. While out adventuring, Peredur comes across a shabby little house in the middle of nowhere made poor by the greed of a ‘serpent’ which is curled around a golden ring and maintains a seven mile exclusion zone to keep people away from it. For no reason more worthy than because it was there, Peredur battles the dragon serpent ‘desperately’, wins, and takes its ring.
‘Just because’ is not an uncommon theme in Welsh literature–remember, tales written and spread by bards were designed primarily to showcase the strength and courage of someone connected to their patron (or to showcase the cowardice and weakness of their patron’s enemies). The focus on those tales was the ingenuity and triumph of the protagonist, not their motivations or backstories.