We study the angular-momentum (AM) buildup in high-$z$ massive galaxies using high-resolution cosmological simulations. The AM originates in co-planar streams of cold gas and merging galaxies tracing cosmic-web filaments, and it undergoes four phases of evolution. (I) Outside the halo virial radius ($R_{\rm v}\!\sim\!100\,{\rm kpc}$), the elongated streams gain AM by tidal torques with a specific AM (sAM) $\sim\!1.7$ times the dark-matter (DM) spin due to the gas' higher quadrupole moment. This AM is expressed as stream impact parameters, from $\sim\!0.3R_{\rm v}$ to counter rotation. (II) In the outer halo, while the incoming DM mixes with the existing halo of lower sAM to a spin $\lambda_{\rm dm}\!\sim\!0.04$, the cold streams transport the AM to the inner halo such that their spin in the halo is $\sim\!3\lambda_{\rm dm}$. (III) Near pericenter, the streams dissipate into an irregular rotating ring extending to $\sim\!0.3R_{\rm v}$ and tilted relative to the inner disc. Torques exerted partly by the disc make the ring gas lose AM, spiral in, and settle into the disc within one orbit. The ring is observable with 30\% probability as a damped Lyman-$\alpha$ absorber. (IV) Within the disc, $<\!0.1R_{\rm v}$, torques associated with violent disc instability drive AM out and baryons into a central bulge, while outflows remove low-spin gas, introducing certain sensitivity to feedback strength. Despite the different AM histories of gas and DM, the disc spin is comparable to the DM-halo spin. Counter rotation can strongly affect disc evolution.