Thermal energy storage is crucial in improving the utilization efficiency of intermittent renewable energy. The extensive cavities created by ores/coal extraction in underground mines provide a unique opportunity for thermal energy storage and extraction. However, the energy performances during thermal energy storage in the complex underground spaces with different rock formations are still unclear. The present study evaluates the effects of geologic layering on thermal energy storage performances in underground mines by numerical method. A numerical fluid mechanics and heat transfer model for underground mine spaces was developed in Fluent to reveal the heat transfer happening in backfill and surrounding rocks during heat storage and extraction. The results obtained from the validated numerical model highlighted the importance of surrounding rocks in underground mine thermal energy storage by comparing the energy performances with assuming the surrounding rocks as thermal isolation materials (setting the thermal conductivity as 0.01 W/mK) and heat storage materials (setting the thermal conductivity as 0.5–5.8 W/mK). However, heat transferred to surrounding rocks diffused and lost seriously with the increase of thermal conductivity of surrounding rocks, leading to the decrease of total energy extracted and water temperature at the end of extraction. It was suggested from the orthogonal test of rock formations with different geologic layering on energy performances that the appropriate geologic layering for high thermal energy storage efficiency should have the high thermal conductivity of rock close to heat exchange tubes and low thermal conductivity of rock far away from heat exchange tubes.