Deuteronomy 9:4-5 - Do not say in your heart when the LORD your God has driven them out before you, Because of my righteousness the LORD has brought me in to possess this land, but it is because of the wickedness of these nations that the LORD is dispossessing them before you. It is not for your righteousness or for the uprightness of your heart that you are going to possess their land, but it is because of the wickedness of these nations that the LORD your God is driving them out before you, in order to confirm the oath which the LORD swore to your fathers, to Abraham, Isaac and Jacob.
God was pronouncing judgment on the Canaanites for their wickedness. He has every right to do that, being the Creator of the Universe and of mankind.
I have no problems with God judging the Canaanites for their wickedness... What I have trouble with is why he uses His people, the very ones He commanded not to murder, to kill.
Why didn’t God just destroy them Himself?