There was a deep pit close to the bank of River Yamuna that flowed by Vrindavan. In this pit lived an extremely poisonous Kaliya Nag (cobra) along with its family. This Kaliya had a hundred and one hoods that spat poison continously, which had poisoned that part of the Yamuna.
One day the Gualas brought their cattle to the Yamuna near that pit. As soon as the cattle drank the water, most of them lay dead then and there. Not only this, some Gualas also met with the same fate.
This became the cause of concern and discussion for Nandbava and all the elderly people in Vrindavan. Krishna overheard this discussion and decided to kill the Kaliya in order to prevent water of Yamuna from being poisoned any more and protect his people.
One day, Krishna intentionally went near that pit to play with his Sakhas. While playing, he threw the ball into the pit purposely and then he told his sakhas that he will get the ball. So he climbed a near by tree and jumped into the river. This caused a great chaos amongst the sakhas and few of them ran to Nandbava immediately.
Kaliya, as the Nag was popularly called, got furious and hissing violently, it gripped Krishna in its curl and caused him to swoon. The Gualas raised a hue and cry and the entire village of Vrindavan assembled at the shore.
Krishna began to enlarge his body's girth and the bones of Kaliya's body began to break. Feeling done up, he left Krishna free. Krishna now began to dance on the hoods of the Nag. At the same time, he began to play on his flute. Kaliya's hoods got bruised and he begged to be pardoned. His wives too implored Krishna to pardon their husband. Krishna agreed and the Nag moved to some other place leaving that pit for ever.