The steady advance of the Israelites through the land sends waves of fear through the local Canaanite leadership, forcing them to rethink their strategies. News of Joshua's military and political successes drives these local kings to launch a counteroffensive. Interestingly, this military campaign is not aimed directly at the invading army, but rather at their own neighbors.
The leader of this coalition is the king of Jerusalem, Adoni-Tzedek. While some view this as his personal name [מצודת ציון], the primary approach among commentators is that it serves as an official royal title held by all kings of Jerusalem throughout history, much like the title of Pharaoh in Egypt. This specific title exists because Jerusalem has always been known as a place of justice [רד״ק, חומת אנך, רלב״ג].
The first report to reach the king is that Joshua has captured the city of Ai, completely destroying it and killing all its inhabitants [ביאור שטיינזלץ]. Realizing that both Jericho and Ai have been entirely wiped out makes it clear to the Canaanite kings that the Israelites are not merely conquering individual cities to establish dominance. Instead, they intend to completely destroy the existing nations of the land, a fact that spurs the kings into immediate action. At the same time, hearing that Ai was defeated through deception and military ambushes gives the king of Jerusalem a false sense of confidence. He mistakenly concludes that the Israelites' strength is limited and relies heavily on strategy, leading him to believe they can be defeated in battle [מלבי״ם].
However, the second piece of news is far more threatening. The inhabitants of Gibeon, a large and powerful city, have surrendered and made peace with Israel. This breaks the spirit of the local kings, who reason that if a mighty city like Gibeon cannot withstand the Israelites, they certainly stand no chance [מלבי״ם]. Following this treaty, the Gibeonites become dependents, living under the protection of the Israelites [מצודת דוד, ביאור שטיינזלץ].
The king of Jerusalem views Gibeon's actions as a series of severe betrayals. First, rather than uniting with the other nations to avenge the blood of those killed in Jericho and Ai, the Gibeonites chose to surrender. Second, the fact that the ordinary citizens of Gibeon initiated this treaty on their own is seen as a dangerous rebellion against royal authority. The king of Jerusalem fears that his own citizens might similarly go behind his back to make peace with the enemy [אברבנאל].
Beyond the ideological betrayal, Gibeon's surrender poses a massive strategic danger. Because Joshua destroyed Jericho and Ai, the Israelite army lacks a physical base of operations. By allowing the Israelites to settle among them, the Gibeonites provide the invading army with shelter, cities to inhabit, food, and vital supplies. This logistical support enables the Israelites to sustain a long-term military campaign [מלבי״ם, אברבנאל].
As a result, the coalition of the five Amorite kings, led by Adoni-Tzedek, does not set out to fight the Israelites. Their primary target is Gibeon. They aim to punish the city measure for measure for its betrayal and establish a brutal deterrence, ensuring that no other cities will surrender and offer aid to the enemy [אברבנאל, חומת אנך, מלבי״ם].