The latest observations of molecular gas and the atomic hydrogen content of local and high-redshift galaxies, coupled with how these correlate with star formation activity, have revolutionized our ideas about how to model star formation in a galactic context. A successful theory of galaxy formation has to explain some key facts: (i) high-redshift galaxies have higher molecular gas fractions and star formation rates than local galaxies, (ii) scaling relations show that the atomic-to-stellar mass ratio decreases with stellar mass in the local Universe, and (iii) the global abundance of atomic hydrogen evolves very weakly with time. We review how modern cosmological simulations of galaxy formation attempt to put these pieces together and highlight how approaches simultaneously solving dark matter and gas physics, and approaches first solving the dark matter N-body problem and then dealing with gas physics using semi-analytic models, differ and complement each other. We review the observable predictions, what we think we have learned so far and what still needs to be done in the simulations to allow robust testing by the new observations expected from telescopes such as ALMA, PdBI, LMT, JVLA, ASKAP, MeerKAT, SKA.