When World War I broke out, the Wilson Administration's policy was to maintain a strict neutrality. This proved difficult to do, however, as most (but by no means all) Americans favored the Allied Powers, especially Great Britain. Moreover, the United States insisted on maintaining trade relations with all belligerent powers, and since Great Britain had imposed a blockade on German ports, this meant in effect that the United States only traded with the Allied Powers.
Germany responded by launching submarine attacks on Allied shipping, which often resulted in American losses of life and property, most famously when a U-boat torpedoed the Lusitania, a luxury liner that was surreptitiously carrying munitions, killing 128 American passengers. In response to US protests, the German government agreed to restrict its U-boats to military targets in early 1916. Yet one year later, facing starvation due to the British blockade, the German high command chose to resume unrestricted submarine warfare in a desperate bid to weaken the British economy.
This decision was accompanied by a (possibly forged) telegram to the German minister in Mexico, instructing him to offer terms for an alliance between Germany and that nation. These two events, combined with the sinking of a handful of American ships in March of 1917, caused Wilson to ask Congress for a declaration of war in April of that same year.