Both smart cards and TPM are computing environments that can store cryptographic keys and perform cryptographic operations, and performing cryptographic operations involving keys that they store is their primary purpose.
If your operating system supports TPM, it will offer to store keys and passwords inside the TPM and to perform operations on those keys. The interface to do this is often considered a smart card interface because smart cards were the first commonplace type of device that could do this and there isn't a commonly accepted generic term for “computing environment with its own key storage that can perform operations involving these keys”. But see What are the differences between HSM and SE? about terminology.
The advantage of having the smart card or the TPM perform these cryptographic operation is that the keys are better protected than if they were stored on the PC. The isolation between the TPM/smartcard and the main CPU makes it harder for a software vulnerability to expose the keys, and depending on the degree of physical isolation of the TPM, it may be resistant against physical attacks as well (for smart cards, resistance against physical attacks is part of the definition).
The first TPM were physically separate chips soldered on the motherboard of a PC, next to the main processor and other chips. TPM chips often have a design that is similar to a smart card chip. Today a TPM may still be a separate chip, or may be a separate processor inside the same physical chip as the main CPU, or a logical environment inside the main chip, roughly in decreasing order of both security and cost. A TPM can also be a piece of software running in a hypervisor, serving as a TPM for a virtual machine.
A smart card is a removable device: you plug it into a computer (or pass it near a computer if it's contactless), and that computer can make requests to it. A TPM is attached to the motherboard of a PC (the virtual motherboard for a virtual PC environment in a virtual machine). Because the TPM is permanently attached to the computer, it can do things beyond storing keys for the user.
In particular, the TPM can read the computer's memory and the processor state. This is called “measuring” in TPM literature, and the output of the measurement is basically a cryptographic hash of the content of the relevant memory. It can produce an attestation of that state, which is a signature of the state made with a key that is only available inside the TPM. The computer where the TPM is running can send this attestation to a server to prove that it is running in a particular software configuration. This is used on secure networks to ensure that only authorized computers running authorized software can connect to the network. The TPM can also store a description of the expected states (the expected hash values) and authorize certain functions only if the computer is in an expected state, for example to disclose the hard disk encryption key only if the boot code is the pre-programmed boot code and not if the boot code has been modified.