Based on the thermodynamic conversion mechanism and energy transition principle, a three-dimensional cellular automata model of grain growth is established from the aspects of grain orientation, grain size distribution, grain growth kinetics, and grain topology. Also, the effect of temperature on the three-dimensional grain growth process of AZ31 magnesium alloy is analyzed. The results show that the normal growth of three-dimensional grains satisfies the Aboav-weaire equation, the average number of grain planes is between 12 and 14 at 420°C and 2000 CAS, and the maximum number of grain planes is more than 40. Grains of different sizes are distributed normally at different times, most of which are grains with the ratio of grain diameter to average grain diameter R/Rm ≈ 1.0, which meets the minimum energy criterion of grain evolution. The grain of AZ31 magnesium alloy increases in size with the increase of temperature, and the number of grains decreases with the increase in time. The angle between the two-dimensional slices of three-dimensional grains is approximately 120°, which is consistent with that of the traditional two-dimensional cellular automata. The relative error of grain size before and after heat preservation is in the range of 0.1–0.6 μm, which indicates that the 3D cellular automata can accurately simulate the heat preservation process of AZ31 magnesium alloy.