The amount of matter, as well as the temperature, are the two factors that determine the thermal energy of the substance.
What is thermal energy?
Thermal energy is the internal energy that a system has when it is in thermodynamic equilibrium due to temperature. The energy of systems that are not in a state of thermodynamic equilibrium cannot be transformed into useful work as easily as thermal energy.
The same fluid or solid in a thermodynamic equilibrium state with the same energy (as thermal energy), however, cannot do work unless it is combined with another substance at a different temperature, as in a heat engine. This is because the same fluid or solid in a thermodynamic equilibrium state has the same energy (as thermal energy), but it cannot be converted to work in a mechanical device.