Curse by Urvashi
When she was bored, Urvashi would leave Indra's realm and come to the realm of men to pleasure herself. One of the men who fell in love with her was Pururava of the Kuru clan. When she left him, as apsara often do when bored of earthly life, he went mad.
Hundreds of years later, Urvashi saw a handsome young man in Amaravati. He reminded her of Pururava and so, dressed in finery, she approached him with the desire to make love.
But the young man turned away from her. This had never happened before. A furious Urvashi asked for an explanation and the man said, 'I am Arjuna, the Pandava, descendant of Pururava. As you were his wife, you are like a mother to me. I cannot be your lover. Besides, you are the beloved of Indra, my father. This would be incest.'
'I am apsara,' said Urvashi, 'I belong to no one. I can go to whoever I please. The morality of mortals does not apply to me. Come, let us make love.'
Arjuna refused because mortal rules still applied to him. Peeved by his intransigence, Urvashi hissed out a curse, 'Only a eunuch refuses a willing woman. So be one,' and walked away in a huff.'
When Indra heard of the curse, he told his son, 'Curses cannot be revoked, but they can be modified. You will lose your manhood, as Urvashi wills it, but only for a year of your choice.' So it came to pass; Arjuna was obliged to spend one year of his life without his manhood.
This worked well for Arjuna for he and his brothers had been exiled from their kingdom of Indraprastha. They had gambled it away and could reclaim it only after spending twelve years in the forest and the thirteenth year incognito. There was also a clause that should their true identities be discovered during the final year of the exile, they would return to the forest for another twelve years. Arjuna realised that he could live out his curse as a eunuch in the final year of exile.
Brihanalla at Virat's Kingdom
After enduring the harsh wilderness stoically for twelve years, the five Pandavas hid their weapons, disguised themselves as servants and sought refuge in the court of King Virata. Arjuna disguised himself as a eunuch-transvestite, introduced himself as Brihanalla or Brihananda, the dance-teacher, and gained employment in the royal women's quarters where he taught dance to the princes, Uttara.
As the year drew to a close, the Kauravas - whose spies had informed them of the Pandavas' whereabouts - invaded Virata's kingdom to smoke out their cousins, while the king and his soldiers were away chasing cattle-thieves. Petrified, the women turned to Virata's young son Uttar who boasted he would drive the invaders away single-handed.
As there were no charioteers around, Brihanalla offered to take up the reins of the war-chariot. This caused great mirth until the prince realised he had no other option.
As Charioteer to Prince Uttara Kumara
As the two rode towards enemy lines, Uttar caught sight of the formidable formations of the invading army - the shining spears, the array of trumpeting elephants - and panicked. He leapt out of the chariot and ran towards the city. Brihanalla ran after him, caught him by the scruff of his neck and dragged him back. Those who witnessed this scene roared in laughter. Unable to bear his public humiliation, Uttar decided to end his life but was stopped by Brihanalla who said he could drive the enemy away provided Uttar served as his charioteer. The prince did not like the idea of serving eunuch until Brihanalla, after much difficulty, convinced him to have faith.
Brihanalla then took the prince to the forest, collected a massive bow from a secret place, strung it and ordered Uttar to take the chariot straight towards the enemy. There, to Uttar's astonishment, the effeminate eunuch - now transformed into a fierce warrior - shot lethal arrows and in no time drove the invaders away.
When the duo returned to the city, Brihanalla resumed his position as charioteer and the palace woman - who had not witnessed the scenes in the battlefield - hailed the prince as their saviour.
The king was very proud of his son. When his courtier, Kanka, who was Yudhishtira in disguise tried to clarify matters and explain what really could have happened, the king got so angry that he slaped Kanka. Everyone wanted to believe that the inexperienced young prince had defeated the mighty Kauravas. It seemed more plausible than the idea that a eunuch-dancer could wield the bow.
Taking Uttara as Daughter-in-Law
When Brihanalla's true identity was revealed, King Virata was so overcome with gratitude that he offered Arjuna the hand of the princes Uttara in marriage. Arjuna politely refused since in his role as dance-teacher he looked upon Uttara as his daughter. Instead, the princes was given in marriage to Arjuna's son Abhimanyu.
Source: Excerpts from the book on "Shikandhi and other tales that they don't tell you" by Devdutt Pattnaik