There were two major factors that determined the timing of the US entry into WWI. First, there was the fact that Germany had decided that it had to go back to unrestricted submarine warfare. Second, there was the Zimmermann Telegram.
Up until early 1917, the US had been trying hard to stay out of the war. Germany had stopped using unrestricted submarine warfare because it did not want to antagonize the US. However, early in 1917, Germany decided that it had to blockade England more effectively if it wanted to have a chance to win the war. It resumed its policy of unrestricted submarine warfare and was soon sinking US ships. At about the same time, the existence of the existence of the Zimmermann Telegram became known. The telegram and the sinking of the US ships were what finally forced Pres. Wilson to ask for a declaration of war in April of 1917.
The States were not eager to get involved in the Great War; but, of course, the Americans having a commun story with the English - and " separated " by the same language, were very sympathic to The United Kingdom against the Tweite Reich.
By 7 May 1915, a German Untersee Boot hit the Lusitania, an USA registered vessel. It sank with about 1,200 people a board.
Now, this ship was transporting ammunition to one of the countries involved in the war; and the Germans were aware of it, thanks to informations out of the USA.
This way the Germans pretended to have the right to blow up ( down ) the ship; that violated America's neutrality.
President Wilson of the States has always been avoiding to get involved, but Germany lost all sympathy in the States.
By 1917 is launched a huge U-boat offensive in the Atlantic. The Czar is in jeopardise weakening the east front. Germany stries to convince Mexico to get on its side.
Too much, Wilson said ! And he sent a message to the Senate.
By 6 April 1917 the USA declares war on Germany.