Kansa in the Hindu religion served as the tyrannical ruler of the Vrishni kingdom. He serves as a major antagonist to Krishna and is most famous for fighting Krishna to the death.
Kansa is the child of King Ugrasena and Queen Padmavati although it is figured out that Kansa isn't Ugrasena's biological child. One time a Gandharva comes to Padmavati and disguises as Ugrasena. Together they have a child and he reveals himself to her. Telling her that their child to be born will be a hybrid between a human and Gandharva. An enraged Padmavati curses Kansa to become a Rakshasa or demon in other words. With that the Gandharva afraid the curse is also aimed at him curses the child further before leaving.
It later is revealed that Kansa has a connection to Vishnu as he was a demon called Kalanemi who the mighty god managed to slay. Trained by other Yadavas who took up to train Kansa and his other eight brothers made Kansa very strong and he now lusted more power. He decided with the suggestions of his advisors to overthrow Ugrasena and take the capital of his kingdom Mathura. A king Jarasandha noticed and decided to let his daughter marry him, It overall just made Kansa more powerful than he originally was and he coronated himself soon after effectively removing his father from the throne by force.
Then soon the goddess Yogmaya told him a prophecy that a woman called Devaki and her husband Vasudeva's eighth child will finally end his tyranny. In order for this not to happen he imprisoned both of them and murdered every child they had until the 7th who was transferred to Rohini by the wishes of Lord Vishnu and this child would be born as Balarama. Soon after this Vishnu was ready to assume the form of the eighth child as Krishna. Yogmaya also came as a baby girl to trick Kansa who attempted to kill this child. Then revealing herself she told him his death was coming by the eighth child who was born.
Escaping from Kansa, Krishna was raised by his father Vasudeva's relatives Nanda and Yasoda and soon Krishna came to face Kansa. They fought and Krishna kicked him on the chest and then his foot lay on Kansa killing him. This was the start of a just rule under Ugrasena once more and soon Kansa's other brothers too were killed by Balarama.