Chandra, the moon, was the grandson of Brahma. Chandra was jealous of the wife of Brihaspati (Planet Jupiter), Tara. Everyone warned him of his jealousy, and tried to help him, but he was driven insane by the jealousy. So, taking a small force of his soldiers, he invaded Brihaspati's Kingdom, and Brihaspati's palace, kidnapping Tara, taking her back to his Kingdom as his own. When she was his captive, he raped her, and impregnated her.
When Brihaspati discovered that his wife had been kidnapped by Chandra, he immediately sought the help of all the other planets - but they were no match for Chandra, and Chandra's armies. They sought the help of many other friends, but Chandra, were just too strong. The gods were called upon to help - and Chandra received the help of the demons, who were always ready for an opportunity to fight the gods. Soon, every being in every world was fighting on one side or another of this war.
Whenever the gods and demons fight, Vishnu intervenes. In the ceasefire, he negotiated the release of Tara, and reparations. Chandra was cured of his insanity, and performed severe penance, and even earned the forgiveness of both Tara and Brihaspati.
But Tara was still pregnant. She did not want to bear the child of her husband's enemy, her captor, her enemy. So she attempted to abort the fetus. Yet it was too late for that - and before she could abort the child, Tara gave birth. The baby was born healthy and beautiful; but then war almost broke out again. Both Chandra and Brihaspati claimed fatherhood of the child: for Chandra was the biological father (from raping Tara), and Brihaspati was the husband of the mother. Chandra wanted to make things right; Brihaspati, too, wanted things to be right. The arguments grew heated, and even Vishnu was perplexed how to avoid a new fight!
Brahma came forward to settle the dispute: while everyone was arguing, no one noticed the child had already achieved the Ashram of Brahmacharya; he therefore had chose his father, and was a child of Brahma. Brahma adopted the child as his own, calling him "wise," Budha, for knowing his father when no one else did.