Context. Markarian 501 (Mrk 501) is a very high-energy (VHE) gamma-ray blazar located at z = 0:034, which is regularly monitored by a wide range of multi-wavelength instruments, from radio to VHE gamma rays. During a period of almost two weeks in July 2014, the highest X-ray activity of Mrk 501 was observed in -14 years of operation of the Neil Gehrels Swift Gamma-ray Burst Observatory. Aims.We characterize the broadband variability of Mrk 501 from radio to VHE gamma rays during the most extreme X-ray activity measured in the last 14 years, and evaluate whether it can be interpreted within theoretical scenarios widely used to explain the broadband emission from blazars. Methods. The emission of Mrk 501 was measured at radio with Mets-hovi, at optical-UV with KVA and Swift/UVOT, at X-ray with Swift/XRT and Swift/BAT, at gamma ray with Fermi-LAT, and at VHE gamma rays with the FACT and MAGIC telescopes. The multi-band variability and correlations were quantified, and the broadband spectral energy distributions (SEDs) were compared with predictions from theoretical models. Results. The VHE emission of Mrk 501 was found to be elevated during the X-ray outburst, with a gamma-ray flux above 0.15 TeV varying from -0.5 to -2 times the Crab nebula flux. The X-ray and VHE emission both varied on timescales of 1 day and were found to be correlated. We measured a general increase in the fractional variability with energy, with the VHE variability being twice as large as the X-ray variability. The temporal evolution of the most prominent and variable segments of the SED, characterized on a day-by-day basis from 2014 July 16 to 2014 July 31, is described with a one-zone synchrotron self-Compton model with variations in the break energy of the electron energy distribution (EED), and with some adjustments in the magnetic field strength and spectral shape of the EED. These results suggest that the main flux variations during this extreme X-ray outburst are produced by the acceleration and the cooling of the high-energy electrons. A narrow feature at -3 TeV was observed in the VHE spectrum measured on 2014 July 19 (MJD 56857.98), which is the day with the highest X-ray flux (>0:3 keV) measured during the entire Swift mission. This feature is inconsistent with the classical analytic functions to describe the measured VHE spectra (power law, log-parabola, and log-parabola with exponential cutoff) at more than 3σ. A fit with a log-parabola plus a narrow component is preferred over the fit with a single log-parabola at more than 4σ, and a dedicated Monte Carlo simulation estimated the significance of this extra component to be larger than 3σ. Under the assumption that this VHE spectral feature is real, we show that it can be reproduced with three distinct theoretical scenarios: (a) a pileup in the EED due to stochastic acceleration; (b) a structured jet with two-SSC emitting regions, with one region dominated by an extremely narrow EED; and (c) an emission from an IC pair cascade induced by electrons accelerated in a magnetospheric vacuum gap, in addition to the SSC emission from a more conventional region along the jet of Mrk 501.