Karna’s story is told in the Mahābhārata, a Sanskrit epic thought to be written from 400 BCE to 400 CE, with oral roots going back to perhaps 800–900 BCE.
The maiden Kunti renders excellent care to a wise old sage, who rewards her with a mantra through which she can have a child with any god she chooses. Although still unmarried, she uses the mantra to compel the sun god Surya to appear, and he arrives carrying her new son. The baby is radiant and powerful like his father, and is wearing armor and divine earrings called Kundala.
Kunti is scandalized that anyone should find out she is an unwed mother, so, in a precursor of the Moses story, she puts baby Karna in a basket and floats him on the Ashwanadi River. He is found by a charioteer and enjoys a happy childhood. As he grows into manhood, he becomes fascinated with the art of war and masters ordinary weapons and the martial arts quickly, but he yearns to learn to wield the divine weapons. The teacher Dronacharya refuses to teach him, as he is only the son of a charioteer, so Karna disguises himself as a Brahmin to sign up with Dronacharya’s own guru, Parashurama. Karna learns everything Parashurama knows and becomes his equal in skill before the guru discovers he’s been tricked.