There are a number of reasons why these kings may have joined forces in an alliance. Possibly, they heard about Israel erecting an altar at Mount Ebal and thereby claiming the whole land of Canaan.1 Alternatively, they simply heard that two Canaanite cities had been destroyed (Joshua 9:3) and thus rather than waiting for Israel to pick them off one at a time.2 they form an alliance and decide to get rid of Israel together.
2 they gathered together as one to fight against Joshua and Israel.