  We perform a theoretical study of the electronic structure and magnetic
properties of the prototypical magnetic MAX-phase Mn$_2$GaC with the main focus
given to the origin of magnetic interactions in this system. Using the density
functional theory+dynamical mean-field theory (DFT+DMFT) method we explore the
effects of electron-electron interactions and magnetic correlations on the
electronic properties, magnetic state, and spectral weight coherence of
paramagnetic and magnetically-ordered phases of Mn$_2$GaC. We also benchmark
the DFT-based disordered local moment approach for this system by comparing the
obtained electronic and magnetic properties with that of the DFT+DMFT method.
  Our results reveal a complex magnetic behavior characterized by a near
degeneracy of the ferro- and antiferromagnetic configurations of Mn$_2$GaC,
implying a high sensitivity of its magnetic state to fine details of the
crystal structure and unit-cell volume, consistent with experimental
observations.
  We observe robust local-moment behavior and orbital-selective incoherence of
the spectral properties of Mn$_2$GaC, implying the importance of
orbital-dependent localization of the Mn $3d$ states.
  We find that Mn$_2$GaC can be described in terms of local magnetic moments,
which may be modeled by DFT with disordered local moments. However, the
magnetic properties are dictated by the proximity to the regime of formation of
local magnetic moments, in which the localization is in fact driven by the
Hund's exchange interaction, and not the Coulomb interaction.
