He didn't kill them all. Which angered God to the point where He promised to always leave them around to bother the Israelites.
So God was angry with Joshua for not killing all the peoples of Canaan? This is certainly some startling news to me, since it was God Himself who helped Joshua keep the Gibeonites alive [Josh 10:1-15] -- even held back the night so that Joshua would have plenty of light to accomplish this. And far from being a bother to Israel, the Gibeonites became their obedient servants forever [Jos 9:22-26]. This would be a strange way indeed for God to express displeasure that some Canaanites were spared, no?
Of course, there were others in Canaan who continued to live among the Israelites after the conquest, but where did you get the notion that this was punishment for Israel? And what evidence is there, beyond idle conjecture, that Israel's present-day enemies can trace their ancestry to those people?