The United States joined the war after a document was intercepted and decoded by the British that demonstrated that Germany had proposed to Mexico that this country should allied itself with the European nation and invade its neighbor to the north.
Many in the United States were opposed to entering into a war in Europe. Like what happen later in WWII, it was a real or perceived threat on our nation that prompted our leaders to declare war. In WWII, our nation might not have gotten into the European war if it wasn't for a treaty that Germany and Italy signed with Japan. Under the terms of the treaty, if one of the signatories was under attack, the other two nations were obligated to declare war on the aggressor. (When I said above "gotten into the European war", I am not discounting the efforts made by the Americans to provide aid to the nations fighting Nazi Germany. When I said the above, I was referring to the notion of troops on the ground.)