I have had this question for a long time. For example, if I wire 50M USD from China to the US, does the Chinese bank physically deliver 50M USD cash to the US bank? or is it just changing a number in the computer? If it's done digitally, then how does the US bank ensure that the Chinese bank isn't just creating USD out of thin air?
For large currency transactions, the big banks go through an intermediary called CLS. Both sides to a transaction transfer funds (in form of central bank deposits) to the CLS group. Then simultaneously these are transferred to the respective parties. Or if one side fails to deliver CLS returns the funds of the other party. See http://en.wikipedia.org/w/index.php?title=CLS_Group .