  Observations suggest a power-law relation between the coronal emission in
X-rays, $L_{\rm{X}}$, and the total (unsigned) magnetic flux at the stellar
surface, $\Phi$. The physics basis for this relation is poorly understood. We
use 3D MHD numerical models of the coronae above active regions, i.e. strong
concentrations of magnetic field, to investigate the $L_{\rm{X}}$ vs. $\Phi$
relation and supply this by an analytical model based on simple
well-established scaling relations. In the 3D MHD model horizontal (convective)
motions near the surface induce currents in the coronal magnetic field that are
dissipated and heat the plasma. This self-consistently creates a million Kelvin
hot corona. We run a series of models that differ by the (unsigned) magnetic
flux at the surface by changing the (peak) magnetic field strength while
keeping all other parameters fixed. In the 3D MHD models we find that the
energy input into the corona, characterized by either the Poynting flux or the
total volumetric heating, scales roughly quadratically with the unsigned
surface flux $\Phi$. This is expected from heating through field-line braiding.
Our central result is the non-linear scaling of the X-ray emission as
$L_{\rm{X}}\propto \Phi^{3.44}$. This scaling is a bit steeper than found in
recent observations that give power-law indices of only up to 2 or 3. Assuming
that on a real star not only the peak magnetic field strength in the active
regions changes but also their number (or surface filling factor), our results
can be consistent with observations. With our model, we give indications of an
understanding of what causes the steep increase of the X-ray luminosity by four
orders of magnitude from solar-type activity to fast rotating active stars.
