A txid or Transaction ID is simply the (double) SHA-256 hash of a transaction. This hash is used to uniquely identify the transaction on the blockchain and on block explorers. When signing a transaction, it is in fact the transaction ID that is signed. Signing the transaction ID ensures that if any part of the transaction changes, the transaction ID changes, and the signature is rendered invalid.

Technically, a txid is not always a hash of the entire transaction. What is included in the hash is determined by the transaction’s sighash flag. If the sighash flag excludes a certain part of the transaction, that part can be changed without invalidating the signature. This is a niche feature which is not often used.