Answer:
Even though the Lusitania was sunk in 1915 and the U.S. only declared war in 1917, the sinking ensured that Americans already had a negative sentiment towards the Germans as 128 Americans died from the incident.
The Zimmerman telegram only made things worse.
The Zimmerman telegram was a message sent to Mexico telling the German Ambassador there to begin negotiations with Mexico such that if the U.S. did not maintain neutrality, Germany would support Mexico in a war against the U.S. so that they may regain the lands lost to the U.S. over the years.
This, in addition to Germany reinitiating unrestricted submarine warfare, led to most Americans calling for war. President Woodrow Wilson obliged and appeared before Congress after some weeks and asked it to declare war.