Chemical evolution of giant molecular clouds in simulations of galaxies