Comparison with TPM
One of the noteworthy differences between the two is that HSMs are removable or external devices. In comparison, a TPM is a chip embedded into the motherboard. You can easily add an HSM to a system or a network, but if a system didn’t ship with a TPM, it’s not feasible to add one later. Both provide secure encryption capabilities by storing and using RSA keys.
Reference
https://en.wikipedia.org/wiki/Hardware_security_module
http://security.stackexchange.com/questions/88744/what-are-the-differences-between-tpm-and-hsm