Early in the war, the United States declared their "isolationism" and "neutrality" meaning that the War was a European war and not one that involved the United States. However, between 1914 - 1917, the Germans taunted the US in various ways.
The Germans practiced unrestricted submarine warfare where their U-boats would attack, and sink, any ship going to a enemy port without warning.
In 1915, the Germans attacked and sunk the Lusitania which was carrying American passengers. The attack on the Lusitania was unfortunate but that alone is not enough for the Americans to enter World War I.
In 1916, the Germans agreed to the "Sussex Pledge" in which passenger and merchant ships would not be targeted.
1917, the Germans broke that pledge.