  We study the dynamics of axions at first-order phase transitions in
non-Abelian gauge theories. When the duration of the phase transition is short
compared to the timescale of the axion oscillations, the axion dynamics is
similar to the trapped misalignment mechanism. On the other hand, if this is
not the case, the axions are initially expelled from the inside of the bubbles,
generating axion waves on the outside. Analogous to the Fermi acceleration,
these axions gain energy by repeatedly scattering off the bubble walls. Once
they acquire enough energy, they can enter the bubbles. The novel ``bubble
misalignment mechanism'' can significantly enhance the axion abundance,
compared to models where the axion mass is either constant or varies
continuously as a function of temperature. The increase in axion abundance
depends on the axion mass, the duration of the phase transition, and the bubble
wall velocity. This mechanism results in a spatially inhomogeneous distribution
of axions, which could lead to the formation of axion miniclusters. It has
potential implications for the formation of oscillons/I-balls, axion warm dark
matter, cosmic birefringence, and the production of dark photons.
