If it’s the first world war this was due to the unrestricted submarine ware fair where the Germans sunk any ships or submarines in one of the oceans. Warning Germany not to sink American ships Germany did and America declared war on Germany. If you are talking about world war 2 then that is due to the Japanese booming Pearl Harbor but missing a flight carrier.