God is love, so why did He command the Israelites to kill the Canaanites? First, if God doesn’t exist, what’s good and evil would be a matter of personal opinion. Why would one person’s opinions be more moral than someone else’s if there’s no objective moral standard? If you reject God’s existence, there is no right or wrong. Anything goes, which is arguably the main reason people try to convince themselves God doesn’t exist.
That said, God does exist. Likewise, the Canaanites were evil. After all, they were burning their children alive as sacrifices to their gods. Since God is holy, He must punish sin. Likewise, God promised to give Abraham and his descendants the land of Canaan. Since God can’t lie, when He makes a promise, He keeps it.
Deuteronomy 9:5 explains: “Not for your righteousness or for the uprightness of your heart do you go in to possess their land; but for the wickedness of these nations Yahweh your God does drive them out from before you, and that he may establish the word which Yahweh swore to your fathers, to Abraham, to Isaac, and to Jacob.” In other words, the Israelites were given the land to be an instrument of God’s judgment against the Canaanite’s and because it would fulfill God’s promise to Abraham.
Still, why were children killed? Deuteronomy 24:16 says that kids aren’t supposed to be punished for crimes committed by their parents. Unfortunately, parent’s sins often impact their children. The death of the Canaanite children was a part of God’s judgment against their parents.
Incidentally, David’s punishment for adultery and murder was losing his infant son. After his son passed away, he said, “I will go to him, but he will not return to me.” Put differently, David couldn’t bring his child back, but he would eventually see him in Heaven. Clearly, it was better for the Canaanite children to be with the Lord than to continue living in such an evil society.