Disk formation and the origin of clumpy galaxies at high redshift