- backstops the US dollar as the world's reserve currency, which allows the US to have a large deficit with low risk to its economic system, which basically means the US can ship paper to other countries and they will send real stuff back to us in return. Let's not kid ourselves, this has a lot to do with the US' large military and financial advantage.
- makes opportunistic authoritarian governments around the world think thrice before invading their neighbors. Consider what it would be like if the charts here were moving up and to the right instead of flat: https://ourworldindata.org/war-and-peace
- ensures the relative safety and efficiency of international shipping routes and underpins global commerce
- provides funding for basic research has lead to many innovations. DARPA, anyone?
- keeps weapons expertise and manufacturing capacity within US borders, which creates US jobs and reduces the capability of other governments to develop competitive arms independently, which keeps them within the sphere of US influence and protection. Other countries look at our military budget and think "we could never compete, let's just buy their weapons, and make nice with the US". Think of what the alternative would look like.
We can debate the morality of the specific wars that the US has gotten entangled in. We can debate the relative size of the military budget, to some degree. But it would be foolhardly to ignore the upsides to military spending altogether.