Based on the spin-fluctuation approach and the first-principles calculations of electronic structure, the mechanism of spontaneous magnetostriction accompanying the first order ferromagnetism–paramagnetism transitions in the Mn2−xFexAs0.5P0.5 magnetocaloric system is analyzed. When simulating the electronic structure of the paramagnetic phase by the state with disordered local moments, it was shown that the main contribution to the emergence of a giant anisotropic magnetostriction was associated with the destruction of local magnetic moments of iron in the layers with tetrahedral anion environment. Relying on the analysis of numerical experiments it was established that the destruction of the local magnetic moments of Fe in the paramagnetic phase with the local Mn magnetic moments conserved was a consequence of disappearance of the long-range ferromagnetic order in the d-electron subsystem of manganese.