We introduce a natural origin of the Peccei-Quinn (PQ) symmetry with a sufficiently good precision. In the standard model, the baryon number symmetry U(1)(B) arises accidentally due to the SU(3)(C) color gauge symmetry, and it protects the proton from a decay at a sufficient level. Likewise, if there is an SU(N) gauge symmetry in the hidden sector, an accidental hidden baryon number symmetry U(1)(BH) can appear. The hidden baryon number is solely obtained by the structure of the SU(N) group. In particular, the quality of the U(1)(BH) can be arbitrarily good for an asymptotically-free theory with large enough N. The U(1)(BH) can be identified as a PQ symmetry. Using our findings, we build two types of novel composite axion models: a model where only one SU(N) gauge symmetry is required to both guarantee the quality and break the U(1)(BH), and a model with SU(N) x SU(M) gauge symmetry where the exotic quarks responsible to the axion-gluon coupling do not confine into exotic hadrons through the dynamical breaking of the PQ symmetry, and have masses of TeV scales.