A quantum algorithm of SU(N) Yang-Mills theory is formulated in terms of quantum circuits. It can nonperturbatively calculate the Dyson series and scattering amplitudes with polynomial complexity. The gauge fields in the interaction picture are discretized on the same footing with the lattice fermions in momentum space to avoid the fermion doubling and the gauge symmetry breaking problems. Applying the algorithm to the quantum simulation of quantum chromodynamics, the quark and gluons wave functions evolved from the initial states by the interactions can be observed and the information from wave functions can be extracted at any discrete time. This may help us understand the natures of the hadronization which has been an outstanding question of significant implication on high energy phenomenological studies.