Each block contains a batch of transactions and a hash of the previous block, which chains them together. Changing an old transaction would change every block after it, and the rest of the network would reject it.
Thousands of nodes keep copies and agree on new blocks through a consensus mechanism. That is what lets strangers trust the ledger without trusting each other.