I know that the Spanish-American war was largely driven by US opposition to European colonialism, but from that point their involvement in the 20th century seems more complicated. I don't think the US would intervene if they didn't gain from it in some way so I'm interested to see why people think they got so involved.
Excellent question. You are right to assume that the US had something to gain from it. Understanding what that exactly was is a little more of a complex issue than simply saying money or trade. For this, we must get into the context of the time. We must get fully into the mind of William McKinley and the people that he governed. Then we can assess what there was to be gained from intervening in Latin America and the Caribbean. It is essential to add in the Caribbean as those interventions coincided with the interventions in Latin America. Let's get to it then!
By the outbreak of the Spanish American war in 1898, the US was in a state of reinventing the ideas laid forth by "Manifest Destiny" and the Monroe Doctrine. Having now fully stretched from coast to coast the American people were becoming restless. There still existed a pioneering spirit, an intense desire for new frontiers. Not only that, but people were itching to be taken seriously on the world stage. We must remember that the United States is in its infancy compared to the established European colonial powers of the time. Young men from all over America scrambled for limited positions within the armed forces.^(1) The people so desired a conflict that might test the mettle of America on the international stage. The conflict that might prove America to be a world power. The view of many upper and middle class folks was one that the US needed a conflict to revitalize national spirit and unity.
The eyes of America would soon turn to Cuba and the waning Spanish Empire. Cuban nationalists had fought a war for independence against the Spanish from 1868-1878. Cuban nationalists were denied any sort of promised reforms post war and were subjected to brutal suppression. The Spanish employed a tactic that would later be used by the US in the Philippines shortly after the Spanish-American war; the systematic imprisonment of insurgents in concentration camps. These were not the death camps of WWII but they were designed to concentrate rebelling individuals in confinement. These deplorable conditions would be touted by the American press as a just cause to intervene in Cuba over. Though, President McKinley would be wary to take the US into war. This can be seen in his "War Message"^(4) where he lays out the reasons for seeking the approval of Congress for a declaration of war. McKinley begs "your just and careful attention in the solemn deliberations" in his message to Congress.
The final spark that drove the US to war in Cuba would be the sinking of the USS Maine in Havana Harbor. This event, of which who was really at fault can only be speculated upon, would give the press^(5) at home the impetus to ramp up the push for war. Thus, on April 25, 1898, William McKinley signed the approved declaration of war against the Kingdom of Spain.
The end of the Spanish-American war begins what many historians call The Banana Wars. This encompasses the US interventions in the Caribbean and Central America from 1898-1934. But this is where we see the interventions proliferating. Why? There are a few reasons that I will explore here. The chief reasons being economic concerns and the global status of the US.
Economic gains are the most obvious when thinking about the Banana wars. The United States had a burgeoning industrial sector that desperately needed new markets to sell its wares to. The most convenient of options would have been their immediate neighbors. But, how would the US pry open these markets and create favorable conditions for the US sellers? The response came in three forms: armed intervention, backing/financing uprisings, and colonial-esque controls post intervention. The reason this period of time is often dubbed The Banana Wars is due to the influence of American fruit companies. The forceful opening of favorable markets would provide them with control over the means of distribution and production, effectively granting the US companies a monopoly.
Armed interventions came most often in the form of occupations of different nations. For the sake of brevity I will omit the insurrections and campaigns fought in newly acquired US colonies including Cuba. One example I will use is the US occupation of Haiti which would last from 1915-1934.^(7) In February 1915 an anti-American revolt against the established dictatorship of Haiti occurred. This caused worry for US business interests, such as the Haitian American Sugar Company, as they feared reprisal or the dissolution of their favorable position. In response to this, Woodrow Wilson ordered the United States Marine Corps to occupy the capital. By November anti-rebel operations would end the first round of hostilities which would flare up again in 1919. The end of what would be called "The First Caco War" would result in the Haitian-American Convention which would place the US in charge of the Haitian economy for 10 years. But US forces would remain until the gradual disengagement in 1933 began. This process is repeated over and over again in places like Honduras, Nicaragua, and The Dominican Republic.
These armed interventions had another effect other than granting the US effective control over these nations. It was an extension and revision of the Monroe Doctrine. The Monroe Doctrine had essentially told the European powers that the Western Hemisphere was a US sphere of influence. Theodore Roosevelt and McKinley made a slight revision to that via their actions. The message would essentially be that if the European powers had debts to collect or scores to settle, they would come to the US first. Then, the US would enforce debt repayments and the like. This was an effort to bring the US to the world stage as a major power. Not only did the US now possess colonial holdings, but they would show the world that their military was capable of competing on the world stage as well. The US Navy would also be able to flex its "muscles" as hopping from one Caribbean island to the next would necessitate. It became a matter of importance after the US had been seen defeating what had once been a global European empire and claiming its former holdings for itself. Proving that the US could best a European power. Now that same attitude would be used to enforce the US sphere of influence in the Western Hemisphere.
The US had two big reasons to be intervening in these regions, girded by the American attitudes and politics of the time. The desire to expand manifest destiny to the world had led the US into conflict with the Kingdom of Spain. The Monroe Doctrine^(6) justified this conflict and opened the door for the US to act as a sort of enforcer for European powers. Victory in Cuba served as a proof of concept that the US military could be successful in armed conflict against a major European power and thus its smaller neighbors. The US sought to solidify the Western Hemisphere as an American sphere of influence and establish itself as a world power. Not only this, but these regions provided a fresh new market for the US to export its goods. The Banana Wars served to bring the US to the world stage and fuel a burgeoning industrial economy at home.
Further readings:
The Banana Wars: A History of United States Military Intervention in Latin America from the Spanish-American War to the Invasion of Panama, by Ian Musicant
The World Cruise of the US Navy, 1907-1909, by Penelope Babcock
----
David Kramer, "The Spanish-American War as a Bourgeois Testing Ground," War, Literature & the Arts: An International Journal of the Humanities, (June 1, 2015): 2.
John Offner, "McKinley and the Spanish-American War," Presidential Studies Quarterly, (March, 2004): 50.
Ibid
John Blassingame, "The Press and American Intervention in Haiti and the Dominican Republic, 1904-1920," Carribean Studies, (July, 1969)
Ibid
Phillip Brown, "American Intervention in Haiti," American Journal of International Law, (October, 1922)
EDIT: Added in text citations of sources.