  In gauge-Higgs unification (GHU), gauge symmetry is dynamically broken by an
Aharonov-Bohm (AB) phase, $\theta_H$, in the fifth dimension. We analyze
$SU(2)$ GHU with an $SU(2)$ doublet fermion in flat $M^4 \times (S^1/Z_2)$
spacetime and in the Randall-Sundrum (RS) warped space. With orbifold boundary
conditions the $U(1)$ part of gauge symmetry remains unbroken at $\theta_H = 0$
and $\pi$. The fermion multiplet has chiral zero modes at $\theta_H = 0$, which
become massive at $\theta_H = \pi$. In other words chiral fermions are
transformed to vectorlike fermions by the AB phase $\theta_H$. Chiral anomaly
at $\theta_H = 0$ continuously varies as $\theta_H$ and vanishes at
$\theta_H=\pi$. We demonstrate this intriguing phenomenon in the RS space in
which there occurs no level crossing in the mass spectrum and everything varies
smoothly. The flat spacetime limit is singular as the AdS curvature of the RS
space diminishes, and reproduces the result in the flat spacetime. Anomalies
appear for various combinations of Kaluza-Klein excitation modes of gauge
fields as well. Although the magnitude of anomalies depends on $\theta_{H}$ and
the warp factor of the RS space, it does not depend on the bulk mass parameter
of the fermion field controlling its mass and wave function at general
$\theta_H$.
