Kaliya (कालिय) was the name of a poisonous Naga living in the Yamuna River, in Vrindavan. The water of the Yamuna for four leagues all around him boiled and bubbled with poison. No bird or beast could go near, and only one solitary Kadamba tree grew on the river bank.
The proper home of Kāliya was Ramanaka Dwipa, but he had been driven away from there by fear of Garuda, Garuda had been cursed by a yogi dwelling at Vrindavan so that he could not come to Vrindavan without meeting his death. Therefore Kāliya chose Vrindavan as his residence, knowing it was the only place where Garuda could not come.
Once Krishna and herdboys were playing ball, and while playing Krishna climbed up the Kadamba tree and hung over the river bank, the ball fell into the river and Krishna jumped after it. Krishna goes down into the river with the intention of sporting in its water. This enraged the hideous monster Kāliya & he rose up with his hundred and ten hoods vomiting poison and wrapped himself around Krishna's body. Thus attacked by Kaliya with his whole brood Krishna appeared to faint away under their murderous onslaught. On seeing Him apparently slain by His enemies the cowboys and all the assembled milkmen filled the air with their loud lamentations. When the Brajvasis came to know that Krishna is enveloped in the coils of serpent they were stunned out of fear and fell down. Even the cows, bulls and small calves became overwhelmed with grief and started crying. All the Brajvasis including animals were just on the point of death as they had dedicated everything to Krishna: their lives, property, affection, activities everything was for Krishna.
But Krishna soon showed that He was quite safe and He forthwith climbed up the hoods of Kaliya and assumed the weight of the whole universe, started kicking and dancing on it. As if Krishna wanted to entertain the grief stricken Brajvasis. He danced in an infinite variety of the most marvelous of figures. The pressure of Krishna’s Feet crushed the towering pride of the myriad-hooded monster. Kaliya lowered his hoods and vomited blood. But the Dance of Krishna did not cease. Kaliya was found tottering towards death when his wives came out of the river and with palms joined in prayer begged Krishna to spare the life of their husband.
The prayers of the wives of Kaliya who had faith in Krishna moved the Son of Nanda to have mercy on Kaliya. Krishna now desisted from His terrific Dance on condition that Kaliya was to quit the river at once and to betake himself to his original home in the island of Ramanaka. Krishna gave him His assurance that Garuda would now do him no harm, as he would respect the print of His Feet on hoods of Kaliya. The water of the River was now rendered immune from all poison and became as sweet as it was before the advent of Kaliya.
Kāliya, recognizing the greatness of Krishna, and surrendered, promising he would not come to vrindavan again and would not harass anybody. So Krishna pardoned him and then let him go free to leave the river and go to Ramanaka Dwipa.
One of the main reason Krishna did not kill kaliya is, Kaliya in his past birth was the sage” Vedshira” who had performed severe austerities. The rishi Vedshira lived in a beautiful ashram and once the “Ashvashira” muni entered in his ashram, seeing him coming, the sage Vedshira shouted on him and said” You are not supposed to perform any penance here, just get out of this place”. Seeing envious and full of hatred behavior ashvashira muni cursed him and said” You are behaving like a serpent who is always angry and envious to others, therefore I curse you to become a snake”.
Kaliya’s wives said "One cannot come in contact with Krishna without having executed pious activities in devotional service in his previous lives”. So, all those are worshipping Krishna must have performed great austerities in their previous lives. Kaliya was fortunate to have realistic and mature wives. The Nagpatnis instead of cursing Krishna said” The punishment which you have so kindly offered is exactly befitting and that is your purpose to annihilate the disturb elements within this world”, so we think it is benediction and your mercy upon us, as even when you punish, the sins are eradicated”. Kaliya’s wives knew that our job is to please Krishna-not to be against him.
This is what association of Krishna does; it washes your sins, kills the impurities in you and sends you back to the supreme god. Either you kill the power or you kill the powerful-result the same. Krishna is the intelligence of the intelligent.
Also know about the birth story behind Karan and Pandavs: