The origin of spin in galaxies: clues from simulations of atomic cooling haloes