The metastable layered compound MnBi2Te4 is the first experimentally realized intrinsic antiferromagnetic topological insulator, predicted to host the quantum anomalous Hall effect at high temperatures upon exfoliation to atomically thin layers. While its magnetic ordering and topological properties have generated intensive interest, the mechanism behind its metastability and the ideal crystal synthesis conditions have remained elusive. Here, using a combined first-principles-based approach that considers lattice, charge, and spin degrees of freedom, we investigate the metastability of MnBi2Te4 by calculating the Helmholtz free energy for the reaction Bi2Te3 + MnTe -> MnBi2Te4. We identify a narrow temperature range (767 K to 873 K) in which the compound is stable with respect to the competing binary phases and successfully synthesize high-quality MnBi2Te4 single crystals using the Bi-Te flux method within this range. We also predict the various contributions to the total specific heat, which is consistent with our experimental measurements. Our findings indicate that the degrees of freedom responsible for the van der Waals interaction, magnetic coupling, and nontrivial band topology in layered materials not only enable emergent phenomena but also determine thermodynamic stability. This conclusion lays the foundation for future computational material synthesis of novel layered systems.