Answer: The US acquisition of Guam, the Philippines, and Puerto Rico meant the US Navy would need to defend territories in both oceans.
Explanation:
The United States was a huge country with coastlines on both the Atlantic and the Pacific oceans and then as a result of the Spanish American war, gained territories in the Pacific being Guam, Philippians and Hawaii as well as Puerto Rico in the Atlantic.
The US therefore needed a way to move their military resources from one coast to the other to defend these territories, coastlines and exert American control over both oceans. The solution was the Panama canal and so the US built it through Gun-boat diplomacy.