No one mentioned how the tx can be verified.
Here's a simple answer: Each full node (
ex. Bitcoin Core client) have a copy of the whole
Blockchain where all of the past unspent and spent transactions were recorded (
the blk files that took a lot of storage space).
When they received a new block, the program automatically verify if that block follows the network rules and what
UTXO was spent and its value (
search for the term).
That way, anyone can't spend a 1BTC UTXO that ends up with 2BTC output.
What if I just purchased 5 BTC from Coinbase using fiat, how will anyone know that I have 5 BTC?
Bitcoin and most cryptocurrencies don't function like a bank account. Your wallet contains nothing but Private keys to be able to spend those unspent outputs.
In simple terms, your balance is the accumulated outputs' value that was stored in the Blockchain, not in your wallet.
As I said above, each node have a copy of the blockchain and every node can verify it
under the hood.