The story of Cain and Abel in the Bible is so tiny it could almost fit into a tweet. Usually the Bible is far more explicit about what God does and why. There’s far more words tracing Cain’s descendants than in the actual killing, but there’s enough there to get a gist of what’s going on.
The reason Cain killed Abel was out of jealousy. Abel offered the choicest and fattest of his sheep to God, while spurning Cain’s offering of his crop. The Bible didn’t really describe Cain’s offering, but given God’s reaction it was obvious Cain could have done better.
Cain then kills Abel out of anger. They talked in the field, and Cain was overcome.
God then both curses Cain by removing his ability to farm, and then also protects Cain by marking him, so that nobody else can kill him.
This is a curious turn of events, and there are lots of questions you can ask here. But the question of why does God not stay Cain’s hand is pretty unambiguous. God doesn’t interfere with people’s free will. He instead forces you to live with the consequences of your actions.
This is pretty well established in the Bible. The one time he does is when he’s the one who ordered the killing in the first place, where he command Abraham to sacrifice his son, then sends an angel to stop him.
You can read the whole thing as a grown-up version of an episode of Barney. Adam’s family had just left the Garden of Eden, they didn’t have much in the way of an education, unless that’s what you want to call eating from the tree of knowledge. Nobody seemed to have much in the way of impulse control at this point in time.
He has a plan, but that plan is malleable. I’m sure he would have preferred that both Abel and Cain populate the world with Adam’s progeny, but he worked with what he had.
It’s possible God intended for Cain to kill Abel, because he wanted Cain to travel the world, not to be a farmer his whole life.