The two factors that are mainly responsible for determining the thermal energy of a substance are Temperature and Mass.
Explanation:
Thermal energy is the total energy of the substance.
Temperature: The temperature and thermal energy of a substance are directly related to each other(direct proportion) which means that the greater the temperature, the greater will be the thermal energy of that particular substance.
Mass: Consider a situation, if we have two or more substances that have the same temperature the substance with the highest mass will have the most thermal energy than the others.