It’s supply and demand, as always. There are foreign exchange markets, functioning similarly to stock exchanges - traders (usually representatives of central banks and international commercial banks) meet there (either in person or electronically through a computer trading platform) to trade currencies. A selling dollars to B for yen, C selling euros to D for sterling, etc. And as always, supply and demand can change. The monetary policy of a country’s central bank may, for instance, increase the supply of its currency, which will (if demand doesn’t increase along with it) lower the forex rate relative to other currencies.
Or demand for a currency might soar, for instance because the country has a high trade surplus and the exporters are converting all the foreign money they made seling their stuff abroad into domestic currency for use at home. This will lead to an appreciation of the currency.
In many cases, central banks try to maintain a fixed value and counteract undesired fluctuations. The Chinese central bank, for instance, keeps (or until recently kept - it’s a matter of ongoing dispute) buying dollars with freshly created renminbi to increase the renminbi supply. Without this, the renminbi would rise relative to other countries’ currencies due to China’s huge trade surplus. For various reasons, the Chinese central bank wishes to avoid that. Conversely, a central bank may decide to use foreign reserves to buy its own currency when demand for that currency is low and it is, therefore, depreciating.
This is a very summary account, and much more detailed explanations are available out there in books or from other dopers, but at the end of the day it all comes down to supply and demand on foreign exchange markets.