The following is a legend which gives the reason for the birth of some famous asuras (demons) and why they got the good fortune of being killed by Lord Vishnu’s various avatars/incarnations.
Once Lord Mahavishnu told his two gatekeepers (dwarapalakas) that he is going to take rest. After a while the holy seven sages (saptarishis) approached Lord Vishnu’s abode to meet him. But, the gatekeepers refused to let the sages meet Lord Vishnu. The sages asked thrice to be allowed to go meet Lord Vishnu but the gatekeepers refused. The sages, who are revered by all the gods, got angered and cursed the gatekeepers saying “may you be born thrice as asuras”. By this time Lord Vishnu came outside and upon seeing the holy sages, invited them inside. The gatekeepers were terrified and fell at Lord Vishnu’s feet to seek shelter from the curse of the holy sages. Lord Vishnu pacified them and said “do not worry, in every birth that you take as an asura, i myself will come and kill you, hence letting you have mokshs(liberation) from the sins you commit as asuras in each birth”. The gatekeepers thanked Lord Vishnu for his compassion and apologised to the holy sages.
Thus the two gatekeepers were born as Hiranyaksha and Hiranyakashipu, who were killed by Lord Vishnu in the form of Lord Varaha and Lord Narasimha. Then they were born as Raavana and Kumbhakarna, who were killed by Lord Vishnu as Lord Rama. Then they were finally born as Kamsa and Banasura (a close confidante of Kamsa) who were killed by Lord Vishnu as Lord Krishna.
Please do share any information you know related to this legend, in the comments. Om