Currency swaps typically happen with automated market makers, where users deposit liquidity into pools, and people who want to swap add the token they want to dispose of and receive the token they want to trade it for (there are other types of automated market makers, but the most popular is the Uniswap v2 model because it's open source and relatively simple).

These pools are managed by smart contracts which run on the blockchain. People providing liquidity deposit their tokens, and as the pool grows from swap fees being added to it, the users' share of the pool also grows.

Here's a random transaction of someone swapping north of 1 quadrillion MGCHI tokens for ~1.3 ethereum: https://etherscan.io/tx/0x3ba500dbf1ba316798f14a98d0d12e8d2e...

The transaction created by the user (whose account address starts with 0x68...) called the `swapExactTokensForETHSupportingFeeOnTransferTokens` function of the Uniswap v2 router contract and sent the MCGHI tokens to it (tokens are actually managed by smart contracts governed by Ethereum's ERC standards as well, so if a user has some number of tokens, the contract for the token actually accounts for that).

The contract being interacted with can be seen here (https://etherscan.io/address/0x7a250d5630b4cf539739df2c5dacb...)

However, this contract apparently interacts with many other contracts which handle (I'm assuming) routing their trade through different pools to give them the best rate, and unwrapping the wETH (wrapped Ethereum which follows the ERC20 standard) into native Ethereum (the native token of the Ethereum blockchain). The reason for this is because wrapped Ethereum behaves the same as other ERC-20 tokens, and can be interacted with in contracts the same as other tokens, so someone, probably the Ethereum foundation, set up a contract where you can send Ethereum and receive wrapped Ethereum, or send wrapped Ethereum and receive Ethereum.

Due to all the computation that happened as part of this transaction (which is effectively composed of many transactions between different smart contracts), the user paid ~$181 in Ethereum for 'gas'. If any step in the interaction had failed, the gas for the computation that already happen would still need to be paid

In practice, most humans using Uniswap are going to use their UI and wallet software (the most popular of which is metamask). When a user makes a trade, the site sends an unsigned transaction to the wallet software, and the software then asks the user to approve/sign it, or reject it. If the user agrees to sign it (usually after confirming that the details of the inputs and outputs are what they expect, and if they're extra-diligent, that the contract address is listed in Uniswap's official documentation), then the transaction is signed with their private keys and sent to the blockchain.

At some point a miner (and validators which are being phased in) will include the transaction in a block, and execute the code in the smart contracts being interacted with to compute various things (in this case, how much Ethereum the user receives, and how much MCGH/Ethereum goes into the pool for transaction fees). The computation is verifiable by all the other network participants since the contract bytecode is part of the distributed ledger.

And so it goes.

By the way, I don't use the Ethereum blockchain at all due to these incredibly high fees (most 'retail' traders don't). Instead I mainly interact with cheaper blockchains which are still EVM compatible, and have bridges to Ethereum. Ethereum still gets a lot of use from the crypto-rich, institutions, and bots though because it's seen as the settlement layer for all smart contract blockchains (and it literally is the settlement layer for many of the layer 2 blockchains)