Who gave anyone the authority to appoint themselves and hence start a royal line? I assume today's royalty come from this royal line The standard answer is Kenneth Macalpine as far as I can see with lesser kings before him, I assume between Scotland and England this where out modern/current royals come from, I was trying to pinpoint exactly where the royalty came from in the first place, I take it they were generally self appointed. Scotland has immense amount of history, very difficult working where things originate from, it seems like the Vikings were possibly the root of most of history or royals
Óengus Olmucaid was a high king of Ireland who also conquered and ruled Scotland in approximately 1000 BC. Around the time of Jesus there was a large emmigration to Albion (Western Scotland) at which time the kingdom of the Dal Riata was firmly established. Later Scottish rulers invariably descend at least in part from this kingdom, the Kings of the Dal Riata. The Dal Riata was founded by Riata Rugaidh (Red Hand).
Kingdoms are founded by force of arms. A king derives his right from being recognized by the soldiers who have conquered a place.
According to Wikipedia (right hand side of article) the foundation of Scotland was 843AD.
Established 9th century (traditionally 843)
The king during this period is widely believed to have been Kenneth MacAlpin, as you have already expressed.
Kenneth MacAlpin (Medieval Gaelic: Cináed mac Ailpin, Modern Scottish Gaelic: Coinneach mac Ailpein;[a] 810 – 13 February 858), or Kenneth I, was the King of Dál Riada (841–850), the King of the Picts (843–858), and the King of Alba (843–858).
Kings of Alt Clut
There are other kings of course which predated Kenneth MacAlpin in the area that became Scotland, but those were just local kings, such as Ceretic Guletic, who according to the "memiors of Saint Patrick" was the king of Alt Clut in the 5th century.
Ceretic Guletic of Alt Clut was a king of Alt Clut (modern Dumbarton) in the 5th century. He has been identified with Coroticus, a Brittonic warrior addressed in a letter by Saint Patrick. Of Patrick's two surviving letters, one is addressed to the warband of this Coroticus. Bemoaning the capture and enslavement of newly Christianised Irish and their sale to non-Christians, Patrick includes the imprecation:1
Kings of Dal Riata
Also the kings of Dal Riata. Despite the fact that certain historians on Wikipedia are sure that Fergus Mor of Dal Riata is mythological, they are certain that his grandchildren are descended from him. Though it may only be his historical career they are disputing, and not his actual existence as a petty king.
These sources, while they offer evidence for the importance of Fergus Mór in Medieval times, are not evidence for his historical career. Indeed, only one king in the 6th century in Scotland is known from contemporary evidence, Ceretic of Alt Clut, and even this identification rests upon a later gloss to Saint Patrick's Letter to Coroticus. The first kings of Dál Riata whose existences are reasonably sure are Fergus's grandsons Gabrán mac Domangairt and Comgall, or perhaps his great-grandson Áedán mac Gabráin.
King of Picts
Also there were historical Pictish kings, such as King Bridei III.
King Bridei III (or Bridei m. Beli; O.Ir.: Bruide mac Bili) (616/628?–693) was king of the Picts from 672 until 693.
Then we have Fergus I from 330BC, whom it is claimed was king of Alba, though there is absolutely no way of proving this, and so Fergus I is considered legendary at best.
King Fergus I (said to have flourished c. 330 B.C.),1 is generally identified as the son of Ferchard, Prince of Scots in Ireland and is the first of the line of Legendary kings of Scotland.
I was trying to pinpoint exactly where the Royalty came from in the first place
They appear to come from different directions. Take for example Cerdic of Wessex, he is believed to have been king of the Saxons and is said to have been originally king of the Gewissae, yet there is no mention of any connection anywhere between petty kings north of hadrians wall, and the Gewissae and it is likely that any suggestion that there were familial connections, would likely not go down well with either side.
Cerdic (/ˈtʃɜːrdɪtʃ/; Latin: Cerdicus) is described in the Anglo-Saxon Chronicle as a leader of the Anglo-Saxon settlement of Britain, being the founder and first king of Saxon Wessex, reigning from 519 to 534 AD. Subsequent kings of Wessex were each claimed by the Chronicle to descend in some manner from Cerdic. His origin, ethnicity, and even his very existence have been extensively disputed. However, though claimed as the founder of Wessex by later West Saxon kings, he would have been known to contemporaries as king of the Gewissae, a folk or tribal group. The first king of the Gewissae to call himself 'King of the West Saxons', was Caedwalla, in a charter of 686.4
I take it they were generally self appointed.
Though there is no citation given, Wikipedia claims that James VI and others, claim ascendancy from Fergus Mor.
Buchanan's king, James VI, shared the scholar's view of the origins of his line, describing himself in one of many verses written to his wife Anne of Denmark, as the "happie Monarch sprung of Ferguse race". Nor was James VI the last ruler to share this belief.
it seems like the Vikings were possibly the root of most of history or Royals
Whilst it can't be proven that this is, or is not the case, that is not what they claim. Take Fergus Mor for example, it is claimed in the Book of Lismore that Fergus assumes ascendancy from a lineage dating back 46 generations, and the legendary Fergus Mor and his historical children already predate the Vikings.
The Senchus and the Duan name Fergus's father as Erc son of Eochaid Muinremuir. A Middle Irish genealogy of the kings of Alba gives an extensive genealogy for Fergus: [Fergus] m. h-Eircc m. Echdach Muinremuir m. Óengusa Fir m. Feideilmid m. Óengusa m. Feideilmid m. Cormaicc, and a further forty-six generations here omitted.2
Irish high king list
Basically, they all claim ascendancy from kings before them. The king list they claim ascendancy from is the Irish high king list, which is claimed dates back to around 1500BC approximately, and can be viewed in this irish high king list here
First Royalty in Scotland?
In actual fact, the first king of Scotland would be Duncan I.
Donnchad mac Crinain (Modern Gaelic: Donnchadh mac Crìonain;1 anglicised as Duncan I, and nicknamed An t-Ilgarach, "the Diseased" or "the Sick";2 c. 1001 – 14 August 1040)3 was king of Scotland (Alba) from 1034 to 1040.
King of the Picts
Quite simply, Kenneth MacAlpin could not have been king of Scotland, because Scotland was not the only kingdom north of hadrians wall during his reign, and his true title was king of the Picts, according to Wikipedia.
Kenneth I is traditionally considered the founder of Scotland, known then as Alba, although he himself, like his immediate successors, bore the title of King of the Picts.
Even Malcolm II, who directly preceeded Duncan I, was only king of the Scots, which is not the samething as king of Scotland, much like king of the Saxons is not the samething as king of England.
Malcolm II (Gaelic: Máel Coluim mac Cináeda; c. 954 – 25 November 1034)2 was King of the Scots from 1005 until his death.3 He was a son of King Kenneth II; the Prophecy of Berchán says that his mother was a woman of Leinster and refers to him as Forranach, "the Destroyer".4
To the Irish annals which recorded his death, Malcolm was ard rí Alban, High King of Scotland. In the same way that Brian Bóruma, High King of Ireland, was not the only king in Ireland, Malcolm was one of several kings within the geographical boundaries of modern Scotland:
Duncan I, 1001AD was first king of Scotland
So, regardless of the petty local kings that preceeded Duncan I, as well as the semi legendary, legendary and mythological kings, Duncan I was the first to be crowned "King of Scotland".
What is the origin of the first dynasty in Scotland?
Since i answered the question, the wording has been changed to something different than i answered.
But the origin of the first dynasty in Scotland was house of Alpin, and it was the Alpinid dynasty
Kenneth MacAlpin (Medieval Gaelic: Cináed mac Ailpin, Modern Scottish Gaelic: Coinneach mac Ailpein;[a] 810 – 13 February 858), or Kenneth I, was the King of Dál Riada (841–850), the King of the Picts (843–858), and the King of Alba (843–858). Inherited the throne of Dál Riada from his father, Alpín mac Echdach, the founder of the Alpínid dynasty.
House of Dunkeld
Though, by the time king of Scots had became king of Scotland, it was House of Dunkeld which Duncan I belonged.
Who gave anyone the authority to appoint themselves and hence start a royal line?
According to traditional mythology, they are descended from the pharoahs.
Scota and Scotia are the names given to the mythological daughters of two different Egyptian pharaohs in Irish mythology, Scottish mythology and pseudohistory.1
What I am getting at is, who gave anyone the authority to appoint themselves and hence start a Royal line, I assume today's Royalty come from this Royal line
At the time, anyone with an army could make himself King of whatever area he could conquer and hold. Constitutions, and prescriptive laws about succession, came rather later. Also, the current British royal house is not from the original Scottish line. They may be related to it, but they don't hold the throne because of that.
The current Royal House is the House of Windsor. They changed their name from "Saxe-Coburg and Gotha" in 1917, because the First World War had aroused considerable amounts of anti-German feeling in the UK. The house of Saxe-Coburg and Gotha had acquired the throne in 1901, when it was inherited by Edward VII, son of Queen Victoria, of the previous house of Hannover, and Prince Albert, who had married Victoria.
The House of Hannover had held the throne since George I had inherited it in 1714 under the provisions of the Act of Settlement 1701. Note that at this point, the UK Parliament had decided who the next monarch would be, without any necessity to follow the customs of inheritance, and it retains that power to the present day.
The Hanoverians were preceded by the House of Stuart, who may have had descent from Kenneth MacAlpin, but that wasn't why they held the Scottish throne. They took the throne of England in 1603, essentially via political agreements. They had held the throne of Scotland since 1371, having acquired it by marriage to the eldest daughter of David II of the House of Bruce.
It's all really complicated, and any assumptions made without knowledge of the history will only be correct by accident. Here is a page about some of the imaginable alternate successions.