Transactions are collected into blocks. Each block carries a fingerprint of the one before it, so changing an old block changes every fingerprint after it. To rewrite history you would have to redo all that work faster than the rest of the network combined.
This is why blockchains are described as immutable. It is not magic • it is the cost of rewriting being higher than the benefit.