We study the dynamics of magnetic fields in chiral magnetohydrodynamics, which takes into account the effects of an additional electric current related to the chiral magnetic effect in high energy plasmas. We perform direct numerical simulations, considering weak seed magnetic fields and inhomogeneities of the chiral chemical potential mu_5 with a zero mean. We demonstrate that a small-scale chiral dynamo can occur in such plasmas if fluctuations of mu_5 are correlated on length scales that are much larger than the scale on which the dynamo growth rate reaches its maximum. Magnetic fluctuations grow by many orders of magnitude due to the small-scale chiral dynamo instability. Once the nonlinear backreaction of the generated magnetic field on fluctuations of mu_5 sets in, the ratio of these scales decreases and the dynamo saturates. When magnetic fluctuations grow sufficiently to drive turbulence via the Lorentz force before saturation occurs, an additional mean-field dynamo phase is identified. The mean magnetic field grows on a scale that is larger than the integral scale of turbulence after the amplification of the fluctuating component saturates. The growth rate of the mean magnetic field is caused by a magnetic alpha effect that is proportional to the current helicity. With the onset of turbulence, the power spectrum of mu_5 develops a universal k^(-1) scaling independently of its initial shape, while the magnetic energy spectrum approaches a k^(-3) scaling.