King Brihadratha of Magadha was married to the twin daughters of the King of Kashi. Brihadratha loved both his wives equally and had all the material joys of the world, but no son. This left him in a depressed state.
The sage Chandakaushika visited his kingdom and Brihadratha served him with respect. Being pleased with his service, the sage granted Brihadratha a boon. Brihadratha asked the sage for a son and the sage gave him a mango, which Brihadratha was to give one of his wives. Now Brihadratha loved both his wives equally so he cut the mango in two equal halves and fed both of them.
Nine months later, both his wives gave birth to a child, or rather half a child each. Seeing this the queens attendants were horrified and decided that they must dispose of the two halves, so they dumped them outside the kingdom. Now outside the kingdom, there lived a demoness named Jara. Sensing human flesh, she found the two halves of the child. Hoping to carry them home to eat them, she placed both the halves side by side in a basket and lo behold the halves miraculously joined up, making one complete human child. Jara realized that this must be the son of the King of Magadha, and wanting a reward, took the child to the palace. The King was overjoyed and named the child Jarasandha in order to honor Jara, the demoness who had saved him.
Jarasandha grew up and became a very powerful king. He defeated many other kings and made them promise their allegiance to him making him supreme emperor. He gave both his daughters in marriage to Kamsa of Mathura.
Now Krishna killed Kamsa, making Jarasandha an enemy. Jarasandha attacked Mathura seventeen times and Krishna decimated his army, sparing Jarasandha alone.
Krishna had five cousins, the Pandavas, who had just acquired a kingdom -Indraprastha. The eldest Pandava, Yudishtra wanted to perform the Rajasuya Yagya. In order to perform the Rajasuya Yagya, a king had to be declared emperor and all the surrounding kingdoms had to recognize the emperor as their overlord. In order for this to happen, Yudishtra would have to defeat Jarasandha and obtain the title of emperor. Yudishtra, not knowing how to go about this, asked Krishna for help. Krishna said that he, Arjuna (the third Pandava) and Bheema (the second Pandava) would dress up like brahmans and go to Magadha and challenge Jarasandha to a wrestling match.
Upon reaching Magadha, Krishna, Arjuna and Bheema challenged Jarasandha to a wrestling match. Jarasandha seeing their physiques realised that these were not brahmans and asked them who they were. Krishna revealed their identities and told Jarasandha that they had come to challenge him and that Jarasandha must pick an opponent. Jarasandha said that he would not fight Krishna as he was a cowherd and he did not match his dignity and social standing. He then refused to fight Arjuna saying that Arjuna was too young, but he agreed to fight Bheema as Bheema seemed mighty and a worthy opponent.
Bheema and Jarasandha fought for days, both equally matched and neither succumbed to the other's blows. Bheema realizing that Jarasandha was an equal match looked to Krishna for help. Now Krishna who knew the story of Jarasandha's birth, picked up a twig from the floor, broke it in two halves and threw the two halves far away from each other.
Bheema now knew what he must do. He threw Jarasandha to the ground, held his legs and split his body in two. He then threw the two halves of Jarasandha far away from each other so that they might not join. Bheema had defeated Jarasandha and Krishna installed Jarasandha's son as the king of Magadha. In return, Jarasandha's son agreed to be a vassal to the Pandavas.