Wait a sec... forget the morality issues of the Canaanites.
One thing no one has mentioned so far is this: God promised the land to Abraham long before the Israelite nation. Abraham settles there and gets pretty comfortable. He doesn't do a whole lot of fighting. But then his descendants leave and go to Egypt because Joseph is powerful in Egypt, and there is a famine in the ancestral home of Abraham.
Things get bad for them in Egypt after some time, and God says, 'I'm taking you back to the land I gave Abraham in the first place.' And this time he meant for them to stay there.
When they get there, well, lookie, other people have moved onto their land. So, they do what nations have always done when they wanted some land: fought wars for it.
The kids had to die because nations of that time seemed to be extra-fond of holding grudges for hundreds of years. So, these kids posed a threat to the descendants of the conquering Israelites.
It seems kinda straightforward. God led them, but he also made them fight for their inheritance. And, times were much more brutal then.