I explained here how God’s destruction of the Canaanites through the Israelites had a dual purpose. First, it was God’s judgment against the Canaanites, and second, it would prevent Israel from taking on the same evil customs practiced by the Canaanites (see also here), enabling their culture to develop in a way that would bless, and ultimately redeem, the people of the world.
So just as God removed an evil, destructive culture in the flood for the sake of the future of all men, so God’s commanding the removal of the Canaanites from Israel’s land was intended to be the deserved judgment that would lead to our salvation. (This was a unique command in salvation history because the New Covenant does not create a physical nation with physical borders.)
But as far as Israel failed to do this, misery resulted. Psalm 106 describes part of what happened:
They did not destroy the peoples,
As the Lord commanded them,
But they mingled with the nations
And learned their practices,
And served their idols,
Which became a snare to them.
They even sacrificed their sons and their daughters to the demons,
And shed innocent blood,
The blood of their sons and their daughters,
Whom they sacrificed to the idols of Canaan;
And the land was polluted with the blood.
Thus they became unclean in their practices,
And played the harlot in their deeds.
Just as God had warned would happen if they failed to follow His command of judgment and removal, the Israelites’ interactions with Canaanite culture drew them in. They followed the gods of the Canaanites and did those idols’ deeds rather than the deeds commanded by the true God. And so instead of reflecting God to the world by acting as a living parable of life and holiness (and opposition to evil), they became an image of death, embracing evil even to the point of murdering their own children.
Even worse, since everyone knew there was a particular God connected with Israel, the Israelites were not only committing murder, they were lying about the very nature of God to the whole world, blaspheming Him as a God of death through their actions. In the end, because they committed the same evils as the Canaanites, they also suffered the same judgment—removal from the land.