Gruffydd ap Llywelyn, one of the most outstanding of Welsh rulers, was the elder son of Llywelyn ap Seisyll, who ruled both Gwynedd and Powys, his mother Angharad, was a daughter of Maredudd ab Owain, the grandson of the great Hywel Dda.
On the death of his father in 1023, Iago ab Idwal ap Meurig, a member of the Aberffraw dynasty, became the new ruler of Gwynedd. Grufydd was forced into exile at the courts of Powys. Grufydd had recovered Powys by 1039, in the same year King Iago of Gwynedd was killed by his own men and his young son Cynan, who was probably around four years of age, was exiled to Dublin. Gruffydd siezed his opportunity and took the northern principality of Gwynedd.
Adopting an aggressive policy toward the English, he defeated a Mercian army at Rhyd y Groes near Welshpool, killing Edwin, brother of the Mercian earl. He then attacked Dyfed, which had once been ruled by his father, Llywelyn ap Seisyll, but was now under the control of Hywel ab Edwin, he defeated Hywel at the Battle of Pencader in 1041 then carried off his widow and married her. The rival prince Gruffydd ap Rhydderch of Gwent expelled Gruffydd from Deheubarth in 1047 and resisted Grufydd's further attacks. In 1055 Gruffydd slew Gruffydd ap Rhydderch in battle and recaptured Deheubarth.
Gruffydd formed an alliance with the Anglo-Saxon Ælfgar, son of Leofric, Earl of Mercia, who had been been ousted from his earldom of East Anglia by the powerful Harold Godwinson (later King Harold II) and his brothers. To cement their alliance, he married Ælfgar's daughter Ealdgyth of Mercia, who was a grand-daughter of the legendary Lady Godiva.
Grufydd and Ælfgār advanced on Hereford, they were opposed by Ralph 'the Timid', Earl of Hereford, whom they defeated. Hereford was sacked and its castle destroyed. The English king Edward the Confessor dispatched his brother -in-law, Harold Godwineson to deal with the situation, Harold built a fortification at Longtown in Herefordshire and refortifyied Hereford. Shortly afterwards Ælfgar was restored to his lands and a peace treaty was concluded.
Gruffydd seized Morgannwg and Gwent, along with extensive territories along the English border. In 1056, he won another victory over an English army near Glasbury. He now claimed sovereignty over the whole of Wales, he was in fact the only King of Wales. From around 1057 until his death in 1063, the whole of Wales recognised his kingship.
Gruffyd ap Llywellyn and Eadgyth of Mercia had three children:-< Maredudd ap Gruffydd (died 1069)
Idwal ap Gruffydd (died 1069)
Nesta ferch Gruffydd, (born circa 1055 at Rhuddlan) married (1)Trahaearn ap Caradog of Arwystle and had issue:-
(i) 1. Owain ap Trahaiam, b. Abt 1045, d. 1081
(ii) Llwarch, Lord of Pembroke, b. 1070, Arwystli, Wales
Nesta married (2) Osbern FitzRichard, Sheriff of Hereford and had issue:-
(iii) Hugh FitzOsbern
(iv) Agnes who married Bernard de Neufmarche.
In late 1062 Harold Godwinson mounted a surprise attack on Gruffydd's court at Rhuddlan. Gruffydd, who had received a warning, managed to escape out to sea In the spring of 1063 an Anglo-Saxon army was led into Wales by Earl Harold's brother Tostig, while Harold simultaneously sailed his fleet to meet up with his brother's army. Gruffydd was forced to seek refuge in the mountains of Snowdonia, where he was killed by members of his own household. Brut y Tywsogion merely states that Gruffydd was 'slain and left in the waste' while The Ulster Chronicle records that he was killed by Cynan ap Iago in 1064, in revenge for the death of his father Iago ab Idwal whom Gruffydd had slain in 1039.
Gruffydd's head and the figurehead from his ship were dispatched to Earl Harold, who married his widow Ealdgyth, who was to be widowed yet again at the Battle of Hastings, which took place but three years later.
Gruffydd's kingdom was divided, his half-brothers, Bleddyn ap Cynfyn and Rhiwallon reached an agreement with Earl Harold and were given control of Gwynedd and Powys. In an attempt to reclaim part of their father's kingdom, Gruffydd's two sons, Maredudd and Idwal fought Bleddyn and Rhiwallon at the battle of Mechain in 1070, but were defeated, Idwal was killed during battle while Maredudd died of exposure after the battle.