Vishwamitra was the king in his early life and was known as Kaushika, the descendent of kusha dynasty. One of the four sons of Kusha was Kushanubha, who performed the sacrifice called 'Puthrakameshti' and had a son named Gadhi. Kaushika or Vishwamitra was the son of King Gadhi.
Kaushika enthroned his father's kingdom after his father Gadhi. He was an expert ruler. Kaushik was very popular among his subjects. Once he had a tour in his kingdom, listening to the complaints of his subjects and advising them the probable remedies.
Once, Vishwamitra and his soldiers took shelter in the Ashram of Rishi Vasishta. Vasishta took well care of his large army and fed them well. Vishwamitra was surprised how it was possible for a sage to take care and made all arrangements to feed such a large army.Vishwamitra wanted to know the mystery from Vasishta. Vashita replied that he had a divine calf Nandini, gifted by Indra. Nandini was the daughter of Indra's cow Kamdhenu. She provided Vasishta with all that he needed.
Vishwamitra or Kaushika was overwhelmed to know the truth. He decided to possess that cow as he thought that a humble sage like Vasishta did not need it much. Vishwamitra expressed his desire to sage Vasishta. Vasishta refused the proposal in a polite but steadfast manner. The king was extremely angry. He insulted Brahmarishi Vasishta with coarse words. Vishwamitra ordered his army to seize the cow and drive it to his kingdom. Vasishta to encounter them created an army of fierce warrior with his yogic power. They fought the army of Vishwamitra and defeated them. Kaushika was imprisoned in the war and presented before Vasishta but the Brahmarishi forgave him and released him with words of advice.
This incident made a deep impression on King Kaushika. He realized that power gained by penances is much greater than the physical power of a king. He resolved to be a greater Rishi than Sage Vasishta and renounced his kingdom. Kaushika then took the name Vishwamitra. After severe austerity and overcoming many hardships Vishwamitra won the title of Brahmarishi by Vashita himself. During his penances he had an affair with the Apsara Menaka and they had a daughter named Shakuntala. This Shakuntala had a son named Bharata, who later became the emperor and India was named after him 'Bharat'.
Kaushika went to the highest mountain to perform severe 'Tapasya' or penance for thousand tears. He ceased to eat and drink and reduced even breathing to a bare minimum. Indra took Kaushika's test and came in the guise of a poor Brahamin who came and beg for food, as Kaushika was ready to break his fast after many years by eating some rice. Kaushika readily gave his food to the beggar and resumed his meditation. Finally Kaushika was able to master his passions and became the Brahmarishi without being provoked by any of Indra's testing and seductive hindrances.
At the climax, Kaushika completed his multi-thousand years journey by attainment of great Yogic power. This time Lord Brahma, the head of Devas named Kaushika a Brahmarishi and also named him Vishwamitra, meaning 'friend of all'. Vasishta embraced Vishwamitra and their enmity was instantly ended.
As a sage, Vishwamitra was regal and was known for his short temperament and he often cursed people in high anger. Thus he misused his Yogic power, which was obtained by much penance. People feared his anger and prayed that the sage might not misunderstand their actions. However as a former king Vishwamitra also possessed great compassion for all beings. Also his love for Menaka was considered passionate and intense beyond imagination.
There are also many legendary stories in the Hindu mythologies regarding Vishwamitra's life. Once, there was a king named as Trisanku who asked his guru, Vasishta to send him to heaven in his own body. The Brahmarishi replied that it was not possible to send one in his body to heaven. Then Trisanku asked Vasishta's seven sons to send him to heaven. The sons were very angry as Trisanku requested them the same thing which their father had denied and cursed him to be a Chandala or untouchable. On the very next day, when Trisanku woke up, he found himself entirely deformed. No one of his subjects could recognize him and he was driven out of the kingdom.
Trisanku then sought the help of Vishwamitra who agreed to aid him. Vishwamitra organized a great sacrifice to propitiate the gods and pleaded them to accept Trisanku in heaven. None of the gods respond. Vishwamitra was angered and used his Yojic powers to send Trisanku to the heaven. Trisanku rose into the sky until he reached heaven but Indra sent him back.
Brahmarishi Vishwamitra was even more enraged and he started making another heaven for Trisanku. When he had completed the heaven, Brihaspati, the teacher of gods ordered Vishwamitra to stop. Trisanku, however did not enjoy his position in the Trisanku Swarga. He remained fixed in the sky and later transformed into a constellation.
In the process of forming a new universe, Vishwamitra used up all his powers, which he gained by austerities. Therefore after the Trisanku episode, Vishwamitra had to undergo the penances to attain the position of Brahmarishi and to equalize Vasishta.
There is another story of Vishwamitra connected to king Harischandra's sacrifice. Harishchandra wanted to please Varuna, the god of oceans, with a sacrifice of his own son Rohita. But when time came, Rohita did not agree to be sacrificed. So they selected a young boy Shunashepa for sacrificing in the yagna, who was sold by his parents. Vishwamitra was at deep meditation when devastated and terrified Shunashepa fell into his feet and asked for help. Vishwamitra taught Mantras to Shunashepa. The boy sang the Mantras to the ceremony, which pleased Indra and Varuna. Both the gods blessed Shunashepa and Harishchandra's sacrifice was also completed.
In Ramayana also, Vishwamitra played a significant role. He was the preceptor of young Rama and his brother Lakshmana. Vishwamitra provided them with knowledge of Devastras or celestial weapons named Bala andAdibala, trained them advanced religion and guided them to kill the demons like Tathaka, Subahu and Mareech. Vishwamitra also led Rama and Lakshmana to Mithila in the Swayambhara of Sita, where Rama and Lakshmana got married.