Transactions are hashed in pairs, then those hashes are hashed in pairs, repeatedly, until one root hash remains in the block header. Proving membership needs only the branch of hashes from your transaction to the root.
This is what makes light wallets possible: your phone can verify inclusion while holding a few kilobytes of headers instead of hundreds of gigabytes of chain data. Airdrop claim lists and proof-of-reserves attestations use the same trick.
Example: a block with 4,096 transactions needs only 12 hashes to prove any one of them is inside, because each level halves the count. That is a few hundred bytes instead of megabytes.
Related: cryptographic-hash, block