The High King of Ireland title was created when the Tuatha Dé Danann colonized Ireland on their arrival 3,700 years ago. Until they were sent back to their Godrealm by the Milesian, the Thuata Dé were living on this part of the World, like any other creature, and the bond between Tir na nÓg and Ireland was so strong the border between the two cosmic planes was almost indiscernible.
Where the King (or Queen) of Tir na nOg was taking care of divine geopolitics, the High King of Ireland was in charge of every topics related to earthly matters, such as dealing with the Fomorians.

After the Milesian evicted the Thuata Dé from Ireland, the High King of Ireland title had no reason to be anymore, but with The Dagda being such a venerated fatherly figure among humans, it was decided to keep the title and make of the High King a sort of Prime Minister, even though The Dagda does not care very much about it.