In Surah 5, Muhammad (poorly) retells the story of Cain and Abel (Genesis 4:1-15):
Surah 5:27-32
27 Relate to them in truth ˹O Prophet˺ the story of Adam’s two sons—how each offered a sacrifice: Abel’s offering was accepted while Cain’s was not. So Cain threatened, “I will kill you!” His brother replied, “Allah only accepts ˹the offering˺ of the sincerely devout.
28 If you raise your hand to kill me, I will not raise mine to kill you, because I fear Allah—the Lord of all worlds.
29 I want to let you bear your sin against me along with your other sins, then you will be one of those destined to the Fire. And that is the reward of the wrongdoers.”
30 Yet Cain convinced himself to kill his brother, so he killed him—becoming a loser.
31 Then Allah sent a crow digging ˹a grave˺ in the ground ˹for a dead crow˺, in order to show him how to bury the corpse of his brother. He cried, “Alas! Have I ˹even˺ failed to be like this crow and bury the corpse of my brother?” So he became regretful.
32 That is why We ordained for the Children of Israel that whoever takes a life—unless as a punishment for murder or mischief in the land—it will be as if they killed all of humanity; and whoever saves a life, it will be as if they saved all of humanity. ˹Although˺ Our messengers already came to them with clear proofs, many of them still transgressed afterwards through the land.
First, recognize that gone is any humanity or realism from the story. Instead, Abel - who of course, sounds just like Muhammad - taunts Cain, and wants Cain to kill him, so that Cain will go to Hell (verse 29).
Secondly, focus on verse 32. It says that as a result of Cain killing Abel, Allah "ordained for the children of Israel that whoever takes a life, it will be as if they killed all of humanity; and whoever saves a life, it will be as if they saved all of humanity".
How does that follow from the story given in verses 27-31? It doesn't. Instead, we have to go outside of the Quran, to the source from which Muhammad plagiarized this story, in order to understand how that follows from the account of Cain killing Abel.
The following passage from Mishnah Sanhedrin gives the source of the teaching referenced in Surah 5:32:
Mishnah Sanhedrin 4:5
5 How does the court intimidate the witnesses in giving testimony for cases of capital law? They would bring the witnesses in and intimidate them by saying to them: Perhaps what you say in your testimony is based on conjecture, or perhaps it is based on a rumor, perhaps it is testimony based on hearsay, e.g., you heard a witness testify to this in a different court, or perhaps it is based on the statement of a trusted person. Perhaps you do not know that ultimately we examine you with inquiry and interrogation, and if you are lying, your lie will be discovered. The court tells them: You should know that cases of capital law are not like cases of monetary law. In cases of monetary law, a person who testifies falsely, causing money to be given to the wrong party, can give the money to the proper owner and his sin is atoned for. In cases of capital law, if one testifies falsely, the blood of the accused and the blood of his offspring that he did not merit to produce are ascribed to the witness’s testimony until eternity.
The proof for this is as we found with Cain, who killed his brother, as it is stated concerning him: “The voice of your brother’s blood [demei] cries out to Me from the ground” (Genesis 4:10). The verse does not state: Your brother’s blood [dam], in the singular, but rather: “Your brother’s blood [demei],” in the plural. This serves to teach that the loss of both his brother’s blood and the blood of his brother’s offspring are ascribed to Cain. The mishna notes: Alternatively, the phrase “your brother’s blood [demei],” written in the plural, teaches that that his blood was not gathered in one place but was splattered on the trees and on the stones. The court tells the witnesses: Therefore, Adam the first man was created alone, to teach you that with regard to anyone who destroys one soul from the Jewish people, i.e., kills one Jew, the verse ascribes him blame as if he destroyed an entire world, as Adam was one person, from whom the population of an entire world came forth. And conversely, anyone who sustains one soul from the Jewish people, the verse ascribes him credit as if he sustained an entire world.
This is also found in Sanhedrin 37a:12-13.
Notice that above, we get an actual explanation for the conclusion that "whoever kills a man, it's as if he killed all mankind". The Hebrew text says the equivalent of "bloods", not "blood", therefore, the commentators argue, Abel's descendants are also in view. This rationalization is nowhere in the Quran. Rather, the conclusion is simply given, as if it followed from the story itself, when it does not, at all. Instead, you have to be reading the Hebrew text of Genesis 4 to even have a chance at arriving at this conclusion, or understanding why anyone else would arrive at it.
So, where does the teaching in Surah 5:32 come from? Conversations between Rabbis, about the Tanakh, recorded in the Talmud. This wasn't revelation given to a prophet, nor was the (errant) conclusion stated here ever a part of the Torah. It's the musing of a Rabbi, likely written well over a thousand years after Moses, recorded in the midst of other explanations of the passage from other Rabbis.
Muhammad frequently placed stories and teachings that were common in his location on the same level as divine revelation, even if they came from non-inspired sources. It was all the same to him, because he had no idea what he was talking about, nor the slightest clue as to what he was supposed to be affirming, when he fraudulently tried to insert himself into the Biblical line of Jewish prophets.