We have performed high-resolution three-dimensional simulations of turbulent interstellar gas that for the first time self-consistently follow its coupled thermal, chemical and dynamical evolution. Our simulations have allowed us to quantify the formation timescales for the most important molecules found in giant molecular clouds (H2, CO), as well as their spatial distribution within the clouds. Our results are consistent with models in which molecular clouds form quickly, within 1–2 turbulent crossing times, and emphasize the crucial role of density inhomogeneities in determining the chemical structure of the clouds.