In Mahabharata, Ashtavakra is described as the hero of a curious legend. It is said that his father Kahoda married his Guru Udddlaka's daughter. He became so concerned with his studies that he neglected his wife when far advanced in her pregnancy. Then his yet to born son is said to have rebuked him for his negligency. The infuriated father pronounced that he should be born crooked in punishment of his disrespect to his father. Therefore, he is known by the name Ashtavakra, which means 'Ashta' i, e, 'eight limbs' and 'Vakra' is curved.
It is believed that once Kahoda, father of Ashtavakra went to the great sacrifice of Janaka, king of Mithila soon after the birth of his son. A Bauddha sage is said to have reached there. The sage overcame all his competitors in argument and threw all of them into the river. When Kahoda tried to face him, he also suffered the same fate. Ashtavakra came to know about this only when he became 12 years old. So, he wanted to take revenge of his father's insult and also moved towards that yet unfinished sacrifice.
The saint Ashtavakra was of young age but very mature in wisdom. He defeated his father's conqueror and tried to throw him in the river. But, on this the sage declared himself to be the son of Varuna, the god of the same waters, who had commenced a similar sacrifice with that of Janaka, at the same time. Then they dismissed their fight with honour and the parties separated mutually content.
Thereafter, Ashtavakra took a bath in Samangd River as instructed by his father Kahoda. It is believed that after taking this bath, he became perfectly straight.