Batman in Batman v Superman, we are dealing with a batman that is broken. Throughout the entire movie we are always reminded about how much he has lost and continues to lose and even gets a vision of the future of what he will lose. How can you not blame him for killing especially when Lex is pulling his strings.
The moment Batman in Batman v Superman is about to kill superman and superman says his mother’s name, that’s when batman snaps, that’s when he realizes that he has become the villain. He also sees the striking humanity in superman. He is looking at superman as a young Bruce Wayne that was pleading for his mother’s life the same way superman is now and at that exact moment he promises superman that Martha won’t die tonight. That’s the moment he becomes batman again. They even give you a demonstration of him being the real batman with a fight scene saving Martha.
It also follows up with batman confronting Lex about to brand him, the fact that he didn’t punched the wall instead was a symbolic message that he doesn’t kill anymore. Superman essentially saved batman by giving him hope again. That’s why he says in superman’s funeral “I failed him in life, I will not fail him in death” even inspiring Wonder Woman to give a mankind a second chance with a speech. His death was necessary to show the good in everyone, he sacrificed everything for “his world” and that is a VERY STRONG biblical reference to Jesus Christ, the entire movie he is referred to as “God” and in the end it shows he is alive again and will be back.
I think there’s another layer to that scene as well – Batman in Batman v Superman also realizes his own hypocrisy – while he had previously accused Superman of having the potential to become malevolently corrupted, Batman has ultimately become malevolently corrupted himself (with him, no doubt, recalling Alfred’s words on how cruel the once good man of Batman has become), as he has abandoned is no-kill rule following the Black Zero Event, and had allowed Lex Luthor to manipulate him into becoming the abominable killer of Martha’s son, much like how Joe Chill had orphaned Batman himself, the son of another Martha. Hence, Batman hurls the spear away in disgust, horrified at what he had almost become, and he is now prepared to help Superman, whom he now better understands, while also redeeming himself in his own eyes in the process (for being such a hypocrite).
Batman in Batman v Superman has good reason to be fearful of Superman. He didn’t see him rescue Metropolis, from his perspective he just saw Superman and Zod destroying buildings and level a city. That’s all he knows. If a demigod alien flew down from the sky and made someone piss their pants in fear and hate the alien, but you can’t blame them. It’s not like being you’re fearful of someone from another country, this person isn’t from this planet and his involvement has been nothing but detrimental. The whole point of Wayne’s character is redemption. The feeling of powerlessness he feels when he learns the existence of Superman and metahumans makes him feel insignificant.
All the years Batman in Batman v Superman spent fighting criminals mean absolutely nothing now. That’s the whole idea of the “beautiful lie” concept: that being Batman wasn’t worth it to him in the end since Superman now exists. Superman now makes all his accomplishments look like nothing in comparison just from his sheer power alone. Batman feels as though he’s doing the human race a favour by killing him because EVEN if there’s the smallest chance that he could turn evil, he can’t take that chance. All Bruce knows is that the Earth was better off without Superman. He’s aware of the tiny deeds that he does like saving a “cat out of a tree”, but it ultimately doesn’t matter to him and he has no reason to trust him. He’s spent the past years of his life witnessing good men turn bad, and to him, Superman is no different.
Batman in Batman v Superman also has reason to suspect Superman is evil considering the visions he got from the Flash. Bruce’s motivation to kill Superman was fine. Do other characters have flawed motivations? Sure. But Bruce doesn’t. BvS’s Batman DOES develop– his entire arc is a theme of redemption. After going down the dark path he did, Superman and his sacrifice ultimately changes him for the better. It’s why he doesn’t brand Lex Luthor. Again, you could argue that other characters had weak motivation and I could see where you’re coming from. But Bruce’s motivations are well-realized and understandable.