There were several leaders in Wales who declared themselves the "King of Wales", but there was only one true King of Wales, with that being Gruffydd ap Llywelyn, who ruled all of the Wales territory from 1055 (all of Wales was under his control by 1057) until his death in either 1063 or 1064.
Following the departure of the Roman legions from Wales, the country had become fractured into divided territories, each with their own leaders. The first known person to actually call himself king was Rhodri Mawr, and being from Wales he was by extension called the King of Wales, although he did not control all of the country. Nonetheless, he did unite much of the land under his power, thus demonstrating that it could be possible for Wales to exist independently from the rule of other countries. Though he died in 878, the legacy of what he had accomplished was significant enough to act as motivation for future Welsh leaders to aspire to. This would eventually lead to the rule of Grufudd ap Llywelyn, the first true Welsh King.