Mathura was led by Kansa a wicked king. He had a sister Devaki, who was married to Vasudeva. It was predicted that Sri Krishna would be born to Devaki and would kill the wicked king Kansa. This enraged Kansa and he had all the male child of Devaki killed, after imprisoning Devaki and Vasudeva. But since the eight avatar of Lord Vishnu was bound to kill Kansa, Sri Krishna was born in midnight. All the other children born to Devaki, except Krishna were killed.
Vasudeva managed to save the child from the cruel clutches of Kansa and he exchanged child Sri Krishna with female child of Yashoda. Krishna lived in Gokul during his infancy till the age of eleven years to hide himself from the clutches of his maternal uncle, Kansa. Finally, Sri Krishna kills Kansa. Jai Shri Krishna!