When Krishna visited Indraprastha, Yudhistira asked for his opinion about performing the Rajasuya yagna. Krishna said Yudhistira was worthy of the yagna, but first, they had to take some steps, such as killing Jarasandha of Magadha, freeing the other kings from imprisonment, and conquering the four sides of the earth.
Here, Krishna narrated the events related to the birth of Jarasandha and why he had to be killed by Bhima.

A long time ago, Brihadratha was the king of Magadha. He was a powerful warrior with three akshauhinis of the army – a handsome man with radiant energy like the sun. He married the twin daughters of the king of Kashi and loved them equally. He treated them as his equal partners and never showed preference or partiality to either. However, they couldn’t have children no matter how much they tried and how many sacrifices and yagnas they conducted.
One day, Chandakaushika, the son of Rishi Kakshivat, stopped at Magadha to stay in the kingdom for a few days. The king visited the rishi and paid his respects. He made proper arrangements for the rishi’s stay in the kingdom. Pleased with this, Chandakaushika offered the king a boon.
Brihadratha replied that he had decided to give up the kingdom and go to the forest with his wives as he was unfortunate to not have an heir. The rishi closed his eyes to meditate. Just then, a mango from the tree he was sitting under fell into his lap. The rishi offered the mango to Brihadratha and told him to give it to his queen. He recited a mantra to charge the fruit and said it would give him a son.
Since Brihadratha had two wives, he cut the mango into two equal parts and gave one piece each to them. Soon, the queens conceived and were delighted. However, they gave birth to two half-formed babies. Each part has one hand, one leg, etc. Heartbroken, the queens cried. The midwives wrapped the pieces in a cloth and took them out of the back gates to discard the malformed infants. They left the bundle near a forest.
A while later, a rakshasi named Jara smelled human scent and went in search of food. She lived in the same forest and was a meat eater. She saw the bundle and removed the wrappings. This caused the two parts of the infants to come together. Right before her eyes, the deformed parts became a full-bodied, healthy boy. The newborn opened his eyes and let out a loud cry. Jara knew she couldn’t eat this baby.
Meanwhile, the cry reached the queens in the palace, and they felt their breast milk flow. They rushed out to see Jara holding a baby in her arms. The rakshasi managed to shape-shift into a presentable appearance by then.
Brihadratha and his wives reclaimed their son with immense gratitude. The king asked Jara who she was. She replied that she was a rakshasi who could change forms at will and lived happily in his forest. Jara said she was safe in his kingdom and wanted to return the favor by returning the child. Then, she vanished.
The king named his son Jarasandha after the rakshasi who saved his life. He crowned the boy his heir. A few years later, Rishi Chandakaushika visited Magadha again. The king and queens went to pay homage to the rishi, who blessed them and said that he was aware of all that occurred. The rishi said Jarasandha would grow up to be a formidable ruler with no equal and that he would bring other kings under his subjugation.
When Jarasandha was old enough, Brihadratha and his wives took up vanaprastha and went to live the rest of their lives in the forest. Jarasandha achieved all that was predicted by the rishi.