The largest galaxies in the Universe reside in galaxy clusters. Using sensitive observations of carbon-monoxide, we show that the Spiderweb Galaxy -a massive galaxy in a distant protocluster- is forming from a large reservoir of molecular gas. Most of this molecular gas lies between the protocluster galaxies and has low velocity dispersion, indicating that it is part of an enriched inter-galactic medium. This may constitute the reservoir of gas that fuels the widespread star formation seen in earlier ultraviolet observations of the Spiderweb Galaxy. Our results support the notion that giant galaxies in clusters formed from extended regions of recycled gas at high redshift.