Every deed which Supreme God does is for the welfare of others without any selfishness. Lord Krishna was himself Supreme Lord Vishnu (Poorna-Avatara) posing as human being lessening the weight of Mother Earth which was filled with numerous evil-demonic kings like Kansa prevailing at the time who needed to be punished in order to restore Sanatana Dharma.
STORY OF SIX DEAD CHILD OF DEVAKI:
The first 6 sons of Devaki were sons of Marichi. They once laughed at Sage Devala, as he was very ricketee. He cursed them to be born in Asura yoni. Hence, they were born as the sons of Kaalanemi who was the son of Hiranyakashipu's brother Hiranyaksha. They became known as Sadgarbha. They used to remain in the water at Patala loka performing penance to obtain immortality. Brahma granted them immortality. However Hiranyakashipu became angry at this. He did not like his brother's grandsons obtaining a boon from Brahma since he considered himself as the only worshipable person. Therefore, he cursed them to be born again and be killed by their own father. Accordingly, they were born as Devaki's children and were killed by their own father. Kamsa as Kaalanemi was their father in their earlier birth.
Then what happened to the boon of Lord Brahma that they would be ‘unkillable’? The boon given by Brahma to be immortal and the curse given by Hiranyakashipu to be killed by their father were reconciled by Durga. To make this happen Narad muni went to Kansa after akashvani and feed this idea of “killing all” into his head.
Actually, at the command of Lord Vishnu, Goddess Durga made the six of those sons of Kaalanemi to fall in deep sleep, retrieved their souls from those sleeping bodies and placed those souls in the womb of Devaki. Thus, King Kamsa killed six of his own sons of his earlier body.
This mission of taking the souls from their bodies was called for because Lord Brahma had given the boon of unkillability to the six bodies of sons of Kaalanemi. But, curse of King Hiranyakashipu to all the six to get death at the hand of their father. kaalanemi had also to be fulfilled. While Kalanemi rebirthed as Kamsa, the sons of Kaalanemi took rebirth as the sons of devaki – with the souls of the sons of kaalanemi, even when their actual former bodies were still in the netherworld (Patala) ruled by Mahabali, the daitya king. Goddess Durga did these ‘special’ deeds to fulfill the contradicting boon-curse events.
She had gone to Nether world (pataala-loka), to make the sons of Kaalanemi to sleep, extricated one after other soul from a each individual, placed that soul in Devaki’s womb. Thus Goddess Durga did for six times and Devaki delivered six times and Kamsa killed six of his own boys one by one as per the curse of his uncle Hiranyakasipu. As and when Kamsa killed a child, Durga used to take the soul of that boy to Patala, only to place its soul into the sons of Kaalanemi, only to make them alive once again.
we have to remember that it was same as the travel of soul outside body (pare kaaya pravesham) done by saints like Sri Shankara, so much so, the body does not decompose even after the temporary travel of soul outside body, for a mission. Goddess Durga saw that the boon of Brahma to the six sons of Kalanemi has not come futile, nor the curse of hiranyakashipu went wrong. All the six remained unkillable in the older body, but killed by their father in a fresh body created for the purpose of undergoing the curse.
STORY OF SEVENTH CHILD OF DEVAKI:
In Rama Avatara, Laxmana (incarnation of Adi-shesha) had to obey every command of his elder brother Lord Rama since it is supreme dharma to obey the command of elders. One day, Laxmana complained about this to Rama that he has to obey everything (whether suitable or not according to him). To this, Lord Rama promised Laxmana that in his next incarnation when he shall not be restricted to maryada-limits, he will be younger to him and obey his command. Thats why, Adi shesha (Laxmana) took incarnation as SEVENTH CHILD of Devaki and as an elder brother of Lord Vishnu (Krishna).
AND.....the EIGHTH AVATARA was himself the Supreme Lord Vishnu as Krishna....who posed outwardly as a normal human being to punish the wicked ones, to re-establish the Sanatana Dharma and to award Moksha to saintly or deserving ones.
NOTE: Apart from numerous incarnation of Supreme Lord Vishnu, two incarnations (viz. Rama & Krishna) are considered as Poorna Avatara since in these two incarnations, Lord Vishnu himself descended onto Mother Earth (hence, known as "Svayam Bhagavan") and went back to his Supreme Abode, Vaikuntha with his own body after his mission to restore Sanatana Dharma was accomplished.
Religious knowledge of Sanatana Dharma with devotion.