Kaliya Naga with his wives in the Ramaṇaka Island after his defeat in the hands of Krishna
The story of Krishna and Kāliya is told in the sixteenth chapter of the Tenth Canto of the Bhagavata Purana.
Kaliya was a naga/snake who came to Vrindavan from his home in the Ramanaka Insland, to escape Garuda, their mortal enemy. In Vrindavan, he settled in a lake near the Yamuna river, along with his wives. His poison made the waters extremely toxic, no animals or plants grew in or around it. People around were terrified. Krishna came to know of this and decided to put an end to their suffering.
An epic battle ensured between Krishna and Kaliya. He supposedly had hundreds or thousands of heads, and attached Krishna viciously, coiling his long body around him. Krishna played with him for a while before jumping on his heads and stomping each of those furiously. Kaliya started vomiting blood and poisonous fumes, almost at the brink of death. Then his wives appeared before Krishna, singing his praise and asking him to forgive Kaliya and let him live. Krishna was pleased, he took his flute and played a beautiful tune standing on top of Kaliya's head. Kaliya understood that he was no mere mortal, but the supreme lord himself. Thanking him for his life, he along with his wives, returned to the island of Ramanaka, and Yamuna's water became pure as before.