  We use FIRE simulations to study disk formation in z~0, Milky Way-mass
galaxies, and conclude that a key ingredient for the formation of thin stellar
disks is the ability for accreting gas to develop an aligned angular momentum
distribution via internal cancellation *prior* to joining the galaxy. Among
galaxies with a high fraction (>70%) of their young stars in a thin disk
(h/R~0.1) we find that: (i) hot, virial-temperature gas dominates the inflowing
gas mass on halo scales (>~20 kpc), with radiative losses offset by compression
heating; (ii) this hot accretion proceeds until angular momentum support slows
inward motion, at which point the gas cools to T~10^4 K or less; (iii) prior to
cooling, the accreting gas develops an angular momentum distribution that is
aligned with the galaxy disk, and while cooling transitions from a
quasi-spherical spatial configuration to a more flattened, disk-like
configuration. We show that the existence of this "rotating cooling flow"
accretion mode is strongly correlated with the fraction of stars forming in a
thin disk among a sample of 17 z~0 galaxies spanning a halo mass range of
10^10.5 solar masses to 10^12 solar masses, or a stellar mass range 10^8 solar
masses to 10^11 solar masses. Notably, galaxies with a thick disk or irregular
morphology do not undergo significant angular momentum alignment of gas prior
to accretion and show no correspondence between halo gas cooling and
flattening. Our results suggest that rotating cooling flows (or, more
generally, rotating subsonic flows) that become coherent and angular
momentum-supported prior to accretion onto the galaxy are likely a necessary
condition for the formation of thin, star-forming disk galaxies in a LambdaCDM
universe.
