Thermal energy is the energy a substance or system has related to its temperature, i.e., the energy of moving or vibrating molecules. Atoms and molecules, the smallest particles of any substance, are always in motion. The motion of thermal energy is usually not visible, but we can feel or see its effects. We use thermal energy to cook our food and heat our homes, and we use it to generate electricity.
Thermal energy is not the same as heat. Heat is energy transferred between substances or systems due to a temperature difference between them. So it is correct to say that a system contains thermal energy, but not that it "contains" heat, since heat means energy that is transferred from one thing to another.
The amount of heat transferred by a substance depends on the speed and number of atoms or molecules in motion. The faster the atoms or molecules move, the higher the temperature, and the more atoms or molecules that are in motion, the greater the quantity of heat they transfer.