In physics terminology, thermal energy is used as a generalized term for the part of internal energy of a system that is sum total of kinetic energy of the system that results from the movements of atoms and molecules of the system.
Thermal physics is the branch of physics that deals with the physical process that involve changes (increase/decrease) in the temperature of the system. Thermal energy is just a part of the internal kinetic energy or
thermodynamic energy of a system and it is often confused with total internal energy of the system which is sum total of internal kinetic energy and potential energy of the system.
The random motion of molecules can be described with the help of kinetic theory of matter. According to this theory, matter comprises of atoms and molecules in random motion and while moving from one place to the other, these particles transfer their kinetic energy to nearby particles.
Aaron