Take into account that the thermal energy determines in an indirect way, the temperature of an object and vice versa.
Moreover, the thermal energy, refers to the kinetic energy and vibrational energy of the molecules of an object. These energies, when increase, increase the temperature of the object too.
Then, when the temperature ob the object changes, it means that the thermal energy of the object has changed, due to the change of the kinetic and vibrational energies of the molecules of the object.