Markarian 421 is one the most extreme blazars characterized by a complex, unpredictable timing/spectral variability, strong X-ray outbursts in some epochs, very broad, nonthermal spectral energy distribution (SED) extending over 16-18 orders of frequency and showing a typical two-"hump" structure. The lower-energy component, ranging from the radio to X-rays, is widely accepted to be synchrotron radiation emitted by ultra-relativistic electrons, while the origin of the higher-energy emission (the MeV-TeV range) still remains controversial (synchrotron self-Compton, external Compton, hadronic etc.). All these radiative mechanisms need the presence of highly-relativistic particles in the jet, to be initially accelerated via the Blandford-Znajek mechanism and magneto-hydrodynamic processes in the vicinity of the central super-massive black hole. However, particles lose the energy, required for the emission of the KeV photons, very quickly and the source can maintain its flaring state on the daily-weekly timescales if some additional acceleration mechanisms are continuously at work in the jet. According to the different studies and simulations, particles can gain a tremendous energy due to the propagation of relativistic shocks through the jet: by means of first-order Fermi mechanism at the shock front, or by an efficient stochastic (second-order Fermi) acceleration close to the shock, in the turbulent jet medium. Our intensive X-ray spectral study of Mrk 421 has revealed the dominance of these processes in different epochs: in some periods, the spectral curvature and the photon index showed a positive cross-correlation (expected in the framework of energy-dependent acceleration probability scenario: a particular case of first-order Fermi mechanism), and the source generally demonstrated the a spectral behaviour compatible with the stochastic (second-order Fermi) acceleration (low spectral curvature; anti-correlation between the spectral curvature and the position of the synchrotron SED peak). For our target, relativistic magnetic reconnection seems to be more important during the radio-optical flares. A jet-star interaction process could be the case during 2016 April-August when the source showed a soft gamma-ray excess.