During the majority of WWI, the United States wanted to remain isolated in what many considered to be a European conflict. President Woodrow Wilson himself advocated isolationism until a series of conflicts drew the US into war against Germany.
First, even though Britain was at war, the US remained an active trading partner. The US continued to send merchant ships to and from Britain. In 1915, Germany announced unrestricted warfare against all ships around Britain, including the American merchant ships. Inevitably, the Germans sank an American ship, angering the US public and President Wilson. However, this wasn't enough to get us to declare war on Germany.
Later in 1915, the Germans sank the Lusitania, a passenger vessel traveling around Britain. The Germans claimed that there were munitions on board, so the attack was justified. While it turns out that the Germans were correct in this assumption, it did not matter to the US- 128 Americans had died on the Lusitania. This was a major outrage for American citizens, and public opinion started to shift away from isolation and neutrality.
In 1917, a German telegraph sent from Germany to the German US ambassador was intercepted. This message said that in the event of war against Germany, Mexico should be asked to be a German ally, as a way of damaging the US.
Ultimately, Germany's refusal to stop attacking allied ships, policy of unrestricted submarine warfare, efforts to gain allies against the US, and US public opinion encouraged Congress to declare war against Germany in April 1917.
The US was unable to remain neutral because of flagrant attacks on their ships, relationship with European allied powers, and a strong anti-isolationist public sentiment that developed between 1914 and 1917