The story of why the U.S. came to have such a large military is path dependent and wasn't always the case.
The U.S. had little defense spending relative to GDP prior to, and after, the U.S. civil war, except for a brief surge during WWI, from which the U.S. promptly and dramatically demobilized. But, after a huge WWII surge in defense spending, that spending stayed high due to the post-WWII Cold War.
In the Cold War, the U.S. felt that it was in a bipolar military-political environment. Europe was in ruins and needed U.S. economic support from the Marshall Plan to rebuild. Russia needed to be opposed militarily, and the U.S. as the sole economically stable representative of non-Communists, stepped up to the plate. The Cold War required a military build up, on threat of nuclear war which was still believed to be winnable, and was punctuated with full fledged wars/military actions such as the Korean War and Vietnam War.
After the Vietnam War, Ronald Reagan adopted a policy of high levels of military spending to force the USSR to match this spending on the premise that the U.S. had an economy more capable of engaging in this defense spending without collapsing than the Soviets, a concept many considered historically vindicated when the Soviet Union collapsed in 1989, following in close succession by the splintering of Yugoslavia and Czechoslovakia, and the unification of Germany.
In the wake of the end of the Cold War, U.S. military spending declined significantly, until 9-11 in 2001, when spending was devoted to fighting wars in Afghanistan, in Iraq, and a "war on terrorism" with a global scope. This peaked around ten years later, and has since declined again, but not as rapidly as it did after the Cold War. After all, the war in Afghanistan and the global "war on terror" re ongoing, and the U.S. involved itself in the war against ISIS in Syria and Iraq, after ending the "Iraq War".
Countries in Europe, in contrast, which he leaned on U.S. military protection via NATO in the early days after WWII, and which lacked the resources to participate more directly in the Cold War, normalized a lower level of military expenditure, and refrained from making nearly as great an economic commitment to fight wars in the Afghanistan and Iraq as the U.S. did as a leader of those coalitions. U.S. leadership discouraged collective action by Western Europeans to invest in national defense, when the U.S. had a status quo ante of meeting those needs on their behalf to some extent. The U.S. also had engagements in Bosnia and Kosovo in the post-Cold War period motivated by humanitarian concerns and the ready availability of U.S. military resources in nearby parts of Europe.
Also, the U.S. as one of the largest countries in the world, has global military aspirations that few other countries shared. By 1960, most countries in Europe had granted independence to all or most of their former colonies. Spain and England, which had once sought to maintain world class blue sea navies, abandoned those aspirations to be world class military powers. The Falkland's War was England's last hurrah in that respect. It is much cheaper to fund a military primarily oriented at defense than one intended to maintain global military dominance as a "leader of the free world" which the U.S. aspired to be and could afford better than its fractured peers could unilaterally.
Domestically, defense spending was something that had bipartisan support during WWII and in the early days of the Cold War, and continued to be a signature issue of one of the two major political parties, the Republicans, whose members were much more likely to have been military veterans than Democrats, and who held a more antagonistic view of Communism which was nominally a politically left leaning ideology.
In the 1980s there was a de facto three party system in the U.S., with Southern Democrats siding with Republicans on defense and social issues, while siding with Northern Democrats on economic issues, before realignment ran its course. Since then, Democrats and Republicans have been relatively evenly balanced in political power and alternated control, with Southern Democrats as late as Bill Clinton being wary of losing moderate support by not being sufficiently "pro-defense."
It also bears mention that war seemed more attractive as an option to the U.S., especially when those wars were foreign, than for many of its developed world peers. Europe was ruined by WWI with a high cost in blood and treasure from that war, only to experience phenomenal costs in blood and treasure again in WWII. Those wars were fought on its ground. Japan, similarly, paid a dear price for the part of the war fought in its turf. Essentially none of WWI (or Korea or Vietnam) was fought on U.S. territory, and in WWII, Pearl Harbor in Hawaii was the only notable engagement fought in its territory. The U.S. also joined both WWI and WWII years after those wars started for the initial combatants, so those wars for shorter for the U.S. So, the U.S. did not associated the wars for which it was preparing economically with a threat to its civilians, its infrastructure and its economy. Indeed, the wars that the U.S. fought were generally good for its economy, both putting people to work for defense industries, and provisioning the world which was economic setbacks due to war related damage afterwards.