The legend of Krishna and Arjuna start way before the Mahabharata. It has been said that the duo were the reincarnation of Nara-Narayana. Nara and Narayana were two inseparable sages who were considered to be a part avataara of Vishnu. They were twins born to Dharma (son of Brahma) and Murti (Daughter of Daksha). They took avataras on earth for the welfare of mankind. The sages defeated a demon calledSahasrakavacha (Demon with a thousand armors). By the way it was Sahasrakavacha was reborn as Karna in the Mahabharata Era.
Let’s get into the story of the Demon Sahasrakavacha for minute for I know how confusing it can get. Karna, in his previous birth was known as King Dambhodabhava who by his misdeeds ended up being called a demon. Demons as usual will always want invincibility which they knew was not possible. So they end up asking for all the impossible, which at any cost will have a loop hole that will pave the way to their destruction. So was the case with Sahasrakavacha. He meditated for years and paid austerities to Lord Surya and asked for boon as thus: that he should naturally have thousand armors attached to his body. To kill him one would have to meditate for 1,000 years and fight with him for yet another 1,000 years, by which he would lose just an armor at a time. Thus, he would have to lose all his armors before he could be killed. In any case there was also a clause that stated that if anyone breaks an armor he or she would die, so once Nara had to be brought back to life by Narayana.
Around the same time yet another demon was creating havoc all over the world in the name of Hiranyakasypu. To destroy that demon as we all know Lord took the avataara of Narasimha. After killing Hiranyakashipu Lord Narasimha’s head took the form of Narayana and the body took the form of Nara as a greater plan of vanquishing the thousand armored Demon Sahasrakavacha.
Nara and Narayana took turns for fighting and meditating; while one mediated the other fought the duel with the Demon, thus destroyed all, but one armor. The Demon knew his end was near and he pleaded to the Surya for help, who intervened and helped him. Lord Surya had promised Sahasrakavacha protection and refused to hand him over to Nara and Narayana. At this time, there was Pralaya on Earth due to the change of the Yuga because of which the Demon escapes death. But by his yogic power the all pervading Lord Narayana had declared that he would incarnate as Krishna and the Demon was to be destroyed by Nara in the Dwapara Yuga who would be born as Arjuna, and the wicked Dambhodabhava alias Sahasrakavacha as Karna. In Dwapar Yuga, an “amsa” of Lord Surya and Dambhodabhava was reborn as Karna with Kavacha. It is probably why Karna was said to have had a split personality.