Exchanges are 2 types : centralised and decentralised. Now, if any new user is coming to the centralised platform then they need to deposit BTC (taking BTC as an example). For depositing, each time exchanges create a public key(give this to user to deposit) and private key(hold by exchange). Now, let user have 10 BTC in his wallet (Which he can check in bitcoin explorer). In a day, he traded his 2 BTC against ETH. This 2 BTC he traded with 10 people. So, now his actual balance at his public key would be 8 BTC. And all transaction which he did with 10 people will also get reflected at bitcoin explorer. Trading also works instantaneously. it means as soon as someone sell or bought BTC, his balances get chcngaed accordingly BUT bitcoin actual transaction take 10 minutes for getting first confirmation. So, how the actual system is working behind the scene?
When users deposit cryptocurrency into an exchange, the exchange takes custody. The cryptocurrency is now the exchange's and the exchange adds a corresponding balance for the depositor to their books. The user specific address is only used to identify whom to credit the deposit to. After the deposit, there is no reason to keep track of the funds in the context of the user.
So, now his actual balance at his public key would be 8 BTC.
Tracking all trades on the blockchain would be incredibly inefficient. Rather, the exchange updates the user's balance in their books to increase the ETH amount and decrease the BTC amount. Any balance changes of the user on the exchange are only tracked in the exchange's books until the user withdraws from the exchange. When they withdraw the exchange sends an on-chain transaction to the user and reduces the user's balance by a corresponding amount.
Building off Murch's response, centralized exchanges keep an internal balance sheet for accounts similar to how actual banks do. All trades that happen on the exchange happen between users who have an account and deposited money on them, so the exchange is able to adjust these balances instantaneously - it is just an entry in their database.
To get even more specific, most exchanges have a cold storage, multi-sig vault where users deposit funds to. When the user wants to deposit funds into the exchange, the exchange will generate a new address for the cold storage vault, associate that address with the user's account id, and then monitor that address for any incoming deposits. Once a deposit is received, that user's account is credited.
Until the user decides to withdraw their funds from the exchange, none of the activity is recorded on the blockchain, it is all just database manipulation within the exchange's database.
This is why efforts like Proof of Keys and Proof of Reserves are important, because in theory these exchanges could be adding entries into their database that say they have more Bitcoin in their vaults than they actually do, kind of like how fractional reserve banking works.