To promote the application of alkali-activated phosphorus slag (AAPS), a new type of alkali-activated cement (AAC), this study revealed the mechanisms and differences between Na2SO4 and MgSO4 attacks. During Na2SO4 exposure, the deterioration of AAPS was caused by the expansion of calcium-sodium aluminosilicate hydrate (C-N-A-S-H). The dealkalization of C-N-A-S-H was accelerated by the formation of (NaOH)0, which promoted the polymerization shrinkage of C-N-A-S-H and improved the volume stability of AAPS. During MgSO4 exposure, the deterioration of AAPS was caused by C-N-A-S-H deterioration and Mg(OH)2 expansion, but the Mg(OH)2 layer protected the AAPS from MgSO4 attack. The dealkalization, decalcification and dealumination of C-N-A-S-H was accelerated by the formation of Mg(OH)2 and (NaSO4)−, transforming C-N-A-S-H into magnesium-sodium aluminosilicate hydrate (M-N-A-S-H). The resistance of AAPS to Na2SO4 was excellent, but its resistance to MgSO4 was poorer. These differences were caused by the different binding capacities of Mg2+ and Na+ with OH− and the different degrees of forward movement of the dissolution equilibrium of C-N-A-S-H caused by Na2SO4 and MgSO4.