  CO(J=1-0) line emission is a widely used observational tracer of molecular
gas, rendering essential the X_CO factor, which is applied to convert CO
luminosity to H_2 mass. We use numerical simulations to study how X_CO depends
on numerical resolution, non-steady-state chemistry, physical environment, and
observational beam size. Our study employs 3D magnetohydrodynamics (MHD)
simulations of galactic disks with solar neighborhood conditions, where star
formation and the three-phase interstellar medium (ISM) are self-consistently
regulated by gravity and stellar feedback. Synthetic CO maps are obtained by
post-processing the MHD simulations with chemistry and radiation transfer. We
find that CO is only an approximate tracer of H_2. On parsec scales, W_CO is
more fundamentally a measure of mass-weighted volume density, rather than H_2
column density. Nevertheless, $\langle X_\mathrm{CO}
\rangle=0.7-1.0\times10^{20}~\mathrm{cm^{-2}K^{-1}km^{-1}s}$ consistent with
observations, insensitive to the evolutionary ISM state or radiation field
strength if steady-state chemistry is assumed. Due to non-steady-state
chemistry, younger molecular clouds have slightly lower X_CO and flatter
profiles of X_CO versus extinction than older ones. The CO-dark H_2 fraction is
26-79 %, anti-correlated with the average extinction. As the observational beam
size increases from 1 pc to 100 pc, X_CO increases by a factor of ~ 2. Under
solar neighborhood conditions, X_CO in molecular clouds is converged at a
numerical resolution of 2 pc. However, the total CO abundance and luminosity
are not converged even at the numerical resolution of 1 pc. Our simulations
successfully reproduce the observed variations of X_CO on parsec scales, as
well as the dependence of X_CO on extinction and the CO excitation temperature.
