Well, at your suggestion I did ask ChatGPT, and it pointed to one sort of magic trick: currency swaps between central banks. That is (kind of) a machine where one type of money goes in one side and the other type comes out the other. There's even a cool tracker [1].
But yeah, it's mostly just market forces that keep things stabilized, it seems.
Even central bank swaps aren't magical. The ECB for example has an account for the US Fed, the same way they have an account for HSBC or whatever. The ECB can credit the account for the US Fed, the same way it can for anyone else.
The main trick that folks get hung up on (and, you might be too) is that most "money" is just an IOU from a bank. We've just created a sophisticated way to trade the IOUs and call it "money".
This is pretty much what I was asserting in my original post, my question was if there was some additional mechanism beyond simple market forces.
It's not inconceivable (nor magical in any way) to imagine treaties that would allow an actual conversion from one currency to another, where USD go in one side and Euro come out the other. Situations like this have existed in the past: currencies have been converted when, for example, the former currencies in the Eurozone were converted to Euros.
No such situations exist right now: entities just hold multiple currencies and exchange them for you.
It's simpler than you are imagining. In practice, anyone can make USD go in one side and EUR come out the other. It's just the notion that something is "destroyed" which is wrong. If I owe you x USD, you can call me and we can agree I now owe you y EUR. If my name is "JP Morgan Chase Bank", it's really easy. And, the "m1 money supply" just changed. But, m1 is kind of nonsense because... it includes checking account deposits which are just IOUs from banks. So, no one just got richer (the bank still owes you money) and nothing is really going on.
Your mental model is falling down around the definition of "currency", "money" etc. It isn't what you imagine it is. We just have a system for trading bank receivables and call it "money".
But yeah, it's mostly just market forces that keep things stabilized, it seems.
[1]: https://www.cfr.org/tracker/central-bank-currency-swaps-trac...