In the gospels Jesus is portrayed as being the new king/messiah. The Jewish messiah is most likely based on enthronement/coronation hymns celebrating the Davidic king. These Hebrew enthronement/coronation hymns probably picked up influences from Egyptian and Babylonian enthronement/coronation hymns.
"Scripture and Other Artifacts: Essays on the Bible and Archeology in Honor of Philip J. King" edited by Philip J. King, Michael David Coogan, J. Cheryl Exum, Lawrence E. Stager:
"Biblical Narrative and Palestine's History: Changing Perspectives 2" By Thomas L. Thompson:A number of scholars have suggested that Isaiah's messianic oracles in chapters 9 and 11 were structured as enthronement or coronation hymns celebrating the accession of Hezekiah--or some other king--to the throne. One further body of archaelogical evidence is worth noting here which helps to validate this interpretation of the oracles. Over the years a number of Egyptian coronation hymns have been retrieved from several periods. They reveal patterns of content and imagery that can be found reflected in Isaiah's messianic oracles. To illustrate the similarities, it will suffice here to refer to two hymns that have been published in translation and are readily accessible to readers: the late-thirteenth-century BCE "Joy at the Accession of Mer-ne-Ptah" and the mid-twelfth-century "Joy at the Accession of Ramses IV". First of all, the Egyptian royal hymns typically describe the pharaoh as divinely "given" or "sent" by his father, the great god. "A lord--life, prosperity, health!--is given in all lands...the King of Upper and Lower Egypt"(Mer-ne-Ptah);"All the lands say to him: 'Gracious is the Horus upon the throne of his father Amon-Re, the god who sent him forth, the protector of the prince who carries off every land"(Ramesses IV). Isaiah's words in 9:6, "to us a son is given," may draw upon this established theme in coronation liturgy. The Egyptian hymns apply exalted titles to the pharaoh and describe his reign as eternal. Mer-ne-Ptah is described as "the lord of millions of years, great of kingship like Horus." Ramesses IV is greeted with the exclamation, "Thou ruler--life, prosperity, health!--thou art for eternity!" Isaiah says in 9:6-7, "His name will be called 'Wonderful Counselor, Mighty God, Everlasting Father, Prince Of Peace.' Of the increase of his government and of peace there will be no end." Egyptian royal theology provided a natural context for such exalted language. The pharaoh was asserted to be divinely incarnated and eternal. It is noteworthy that Isaiah employs similar imagery even though the subject of his oracle is clearly identified as a Davidic royal descendant--not a deity himself, but simply a charismatic human agent of the deity. The exalted titles in Isaiah 9:6, therefore, must be seen as applied not to the Davidic king but to the God whose powers are made manifest in him. The Egyptian hymns use superlative imagery also to extol the blessings that the new pharaoh brings to the land--typically peace, justice, and material prosperity. Of Mer-ne-Ptah's accession it is proclaimed: "Right has banished wrong. Evildoers have fallen (upon) their faces. All the rapacious are ignored. The water stands and is not dried up; the Nile lifts high. Days are long, nights have hours, and the moon comes normally." In other words, the new pharaoh has brought harmonious order both to society and to nature. The hymn to Ramesses IV echoes the same double theme: "They who were fled have come (back) to their towns; they who were hidden have come forth (again). They who were hungry are sated and gay; they who were thirsty are drunken...High Niles have come forth from their caverns, that they may refresh the hearts of the common people...The ships, they rejoice upon the deep. They have no (need of) ropes, for they come to land with wind and oars." Isaiah proclaims the same dual theme: the Davidic king will establish perfect justice in the community while perfect peace will permeate nature. "With righteousness he shall judge the poor, and decide with equity for the meek of the earth...The wolf shall dwell with the lamb, and the leopard lie down with the kid"(Isa. 11:4,6). It need not be suggested that Isaiah was directly acquainted with Egyptian royal litanies. It is more likely that the prophet was consciously echoing the literary style and content of earlier Israelite coronation hymns and that they, in turn, quite understandably had appropriated established forms of royal ritual. By combining the archaeological evidence outlined above with a critical examination of the biblical texts, a compelling argument emerges that Isaiah's messianic oracles are, indeed, hymns celebrating the divinely installed king. They are most probably retrospective, however, presented not at Hezekiah's accession but after he had been on the throne for a number of years. The prophet has been inspired by the seemingly miraculous deliverance of 701 BCE to proclaim the king who could then be declared to have been divinely provided for this deliverance. Like other prophets, Isaiah not only looked to the future, he also sought to interpret the true meaning of past events. Here he proclaims that it was Yahweh who had "given" Hezekiah to his people--who had placed his spirit upon this ruler years before in order to prepare for this moment of crises.
"The Messiah Myth: The Near Eastern Roots of Jesus and David" By Thomas L. Thompson:Another thematic element of major importance in Psalm 2's use of the messiah is the divine declaration or decree that he is Yahweh's son, born on that day by god (Ps. 2:7). This is comparable to the official publication of cosmic joy and good news at the accession to the throne of Rameses IV: 'O happy day! Heaven and earth are in joy, for you are the great lord of Egypt.' Similar to the messianic son of Yahweh of Psalm 2:7, Rameses IV is the son of Re. As Horus, Ramses, like Akhenaten before him, takes the throne of his father 'who sent him forth.' Similar to Ramses rule and protection over all nations, Psalm 2's king and messiah governs Yahweh's kingdom: the nations are in his patronage, which embraces the entire world. Like Merneptah, who banishes wrong at his accession and causes evildoers to fall on their face, Psalm 2's messiah is given the power to shatter and crush the nations. Finally, Psalm 2 closes with the phrase: 'happy are those who seek refuge in him,' a verse which reiterates the beatitudes of Psalm 1's eightfold contrast between the way of righteousness and the way of the ungodly. The announcement of Ramses IV's accession presents a similarly structured ninefold version of this poor man's song in order to describe the 'happy' day' for those who come under the king's divine patronage, a trope that plays a central role in the Bible's messianic tradition: "They who were fled have come back to their town; they who were hidden have come forth again. They who were hungry are sated and gay; they who were thirsty are drunken. They who were naked are clothed in fine linen; they who were dirty are clad in white. They who were in prison are set free; they who were fettered are in joy. But troublemakers have become peaceful."
The frequent references to "the kingdom of God" in the gospels and sayings attributed to Jesus in the controversial gospel of Thomas all point to an earlier tradition: like king David before him, the Jesus of the Bible is an amalgamation of themes from near eastern mythology and traditions of kingship and divinity. The theme of a messiah--a divinely appointed king who restores the world to perfection--is typical of Egyptian and Babylonian royal ideology...
Mary and Joseph are told that their son will be king and rule over Jacob's descendants forever.
From gLuke:
In ancient Egypt the pharaoh was given a divine birth myth that portrayed his mother being impregnated by a god and being told that the child will be future king and rule forever.Do not be afraid, Mary; you have found favor with God. 31 You will conceive and give birth to a son, and you are to call him Jesus. 32 He will be great and will be called the Son of the Most High. The Lord God will give him the throne of his father David, 33 and he will reign over Jacob’s descendants forever; his kingdom will never end.”
From "Chronicle of a Pharaoh: The Intimate Life of Amenhotep III" by Joann Fletcher:
"God's Wife, God's Servant: The God's Wife of Amun (ca.740–525 BC)" by By Mariam F. Ayad:At Luxor we can follow the great king from his divine conception right through his life, and beyond. The story begins with Amun diplomatically taking the form of Tuthmosis to visit Mutemwia, who is asleep in the inner rooms of her palace. According to the inscriptions that accompany the temple reliefs, "She awoke on account of the aroma of the god and cried out before him ... He went to her straight away, she rejoiced at the sight of his beauty, and love for him coursed through her body. The palace was flooded with the god's aroma. "Words spoken by Mutemwia before the majesty of this great god Amun-Ra: `How strong is your power! Your dew fills my body,' and then the majesty of this god did all that he desired with her.Words spoken by Amun-Ra: `Amenhotep, ruler of Thebes, is the name of this child I have placed in your body ... He shall exercise the beneficent kingship in this whole land, he shall rule the Two Lands like Ra forever.'" The sandstone reliefs depict the couple's fingers touching briefly—and in this auspicious instant Amenhotep, son of Amun, is conceived.
"Handbook of Egyptian Mythology" By Geraldine Pinch:...a union with the king's mother and the supreme deity imbued the future king with his divine nature. It was precisely this divine nature that enabled an Egyptian king to serve as a mediator between mankind and the gods. Temple scene representing the king's divine conception and birth are known from the reigns of Queen Hatshepsut(c. 1479/73-1458/57 BC) and Amenhotep III(c. 1390-1352 BC)
"The Search for God in Ancient Egypt" By Jan Assmann:Many kings claimed that they, like Horus, had been chosen to rule "while still in the egg". In practice, it was the inaugeration rituals that turned the chosen heir into "the living Horus"...The accession of individual kings might be validated by giving them a divine parent. One such royal birth myth is found in the inauguration incriptions of King Horemheb[c. 1319-1307 BCE]. Horemheb was a soldier who served under Akhenaton and Tutankhamun, but the inscription presents his career in mythological terms. He is called the son of Horus...Horemheb claims that his exceptional qualities were evident as soon as he was born and that Horus of Hnes always intended that he should be king...Horemheb is then able to restore the country and it's institutions to the way things were "in the time of Ra"
The pharaoh would perform a death and resurrection/rebirth ritual at a certain point during his reign.The story...has to do with the divine descent of the royal child. Amun, king of the gods, decides to engender a new king in whose hands rule over the world will be placed, one who will build temples to deities and increase their offerings, and in whose time abundance and fertility will reign. A mortal woman strikes his fancy; Thoth the divine messenger ascertains that she is none other than the queen herself...Amun forms the name of the future child from the words the couple exchange...Thoth is sent to the queen to announce her pregnancy to her...divine nurses suckle the child, and deities bestow blessings on it. As the child grows, it is circumcised, purified, and presented to the assembled deities of the land as the new king...Here, in the myth of the divine birth of the king, we are told that the coronation of the king fulfills the will of the god who engendered the child and "socialized" it into the divine realm to rule as king of the world in peace and fear of god...The story of the divine descent of the royal child was first told of the three kings who began Dynasty 5...and included the title "Son of Re" in the official royal titulary...This fact suggests rather clearly that we are not dealing exclusively with a piece of official royal ideology, but with a concept that was related in the form of a story in various contexts and which must thus have had a certain general influence and popularity in ancient Egypt. The story is also familiar to us today and is still told in a variant that differs in only one respect from the Egyptian version: the kingdom of Christian tradition is not of this world. But Egyptian tradition prepared the way for even this transposition. At a specific point in Egyptian history, the myth changed it's form and it's point of reference. It became a festival drama that was enacted one or more times each year in all the larger temples in the land, and it referred, not to the birth of the king, but to that of the child god in respective temple triads. Now it was the new god who came into the world and ascended the throne. In this version, the emphasis of the myth shifted from it's legitimizing to it's explanatory and meaning-imparting function...Because welfare was no longer embodied in the king, a festival drama was enacted to relate--or, rather, celebrate--how a god had come to bring salvation into the world.
"Amenhotep III: Egypt's Radiant Pharaoh" By Arielle P. Kozloff:
"Temples of Ancient Egypt" by Dieter Arnold:The royal jubilee, or heb-sed, was a festival of renewal rooted in Egypt's most ancient history...The Sed festival traditionally took place during the thirtieth year of the reign...Timing was crucial for the climax of the festival deep inside the royal tomb. There Pharaoh faced the images of the gods represented on his tomb walls and remained for a period of time before going to his funeral bed, where he "died" and was "reborn" in a series of rituals, incantations, and offerings...This resurrection was the culmination of a process of deification that had begun with Amenhoteps III's coronation. At the time, like all Egyptian kings, he was the representative and high priest of each god on earth.
"Temples of Ancient Egypt" by Lanny Bell:Numerous representations attest that the assembly of the Followers of Horus played another, even more important role during the Sed-Festival. This ceremonial regeneration of the king's divine powers was carried out, ideally, thirty years after his coronation or appointment as official successor to the throne. Apparently the rites of this renewal of the royal reign were also performed in the fortress of the gods, where the gods again arrived in the boats that play an important role in this ceremony...These powerful rites, which influenced the nature of Egyptian kingship until the end of pharaonic rule, could culminate in a ceremonial death and rebirth of the aging king.
"The Search for God in Ancient Egypt" By Jan Assmann:During the Sed-Festival, the living king, as part of his eternal cycle, underwent a ritual death and rejuvenation. In the rite's critical climax, the king experienced the nadir of his strength...An almost unbearable tension gripped the priests at the service and the people who waited outside, and when the king reappeared, successfully rejuvenated, their high excitement and enormous relief turned to jubilation.
As Jan Assmann and Thomas L. Thomson say in the quotes above, these "royal myths" were also a part of the mythology surrounding personal savior gods and heroes. In "Assyrian Prophecies" Assyriologist Simo Parpola says the same thing:Quite similarly, at a very early date, Egyptian texts began to celebrate the resurrection of the king, who has emerged from his tomb and ascended to the sky, as a theophany.
So Jesus(whether you think he's historical or not) was given these royal/savior mythological motifs in order to deify him and portray him as king/messiah.The intricate connection between mystery religion, esotericism and emperor cult, crucial to the understanding of ANE prophecy and the origins of ancient philosophy, emerges with full clarity only from the Assyrian evidence. on the other hand, the Assyrian sources, especially their symbolic imagery, cannot be fully understood without the supporting evidence of related traditions