A hardware security module (HSM) is a physical device that provides extra security for sensitive data. It is a removable or external device that can generate, store, and manage RSA keys used in asymmetric encryption
A Trusted Platform Module (TPM) is a hardware chip on the motherboard included on many newer devices and it provides full disk encryption and secure boot. Unlike HSM, TPM is tighly linked to a single device, and this is why it is used for secure boot.
Both TPM and HSM are security modules present on computer system