  Axion-like particles (ALPs) rotate the linear polarization of photons through
the ALP-photon coupling and convert the cosmic microwave background (CMB)
$E$-mode to the $B$-mode. We derive the relation between the ALP dynamics and
the rotation angle by assuming that the ALP $\phi$ has a quadratic potential,
$V=m^2\phi^2/2$. We compute the current and future sensitivities of CMB
observations to the ALP-photon coupling $g$, which can reach $g=4\times
10^{-21}\,\mathrm{GeV}^{-1}$ for $10^{-32}\,\mathrm{eV}\lesssim m\lesssim
10^{-28}\,\mathrm{eV}$ and extensively exceed the other searches for any mass
$m\lesssim 10^{-25}\,\mathrm{eV}$. We find that the fluctuation of the ALP
field at the observer, which has been neglected in previous studies, can induce
significant isotropic rotation of the CMB polarization. The measurements of
isotropic and anisotropic rotation allow us to put bounds on relevant
quantities such as the ALP mass $m$ and the ALP density parameter
$\Omega_\phi$. In particular, if LiteBIRD detects anisotropic rotation, we
obtain the lower bound on the tensor-to-scalar ratio as $r > 5 \times 10^{-9}$.
