Observations and theoretical simulations have established a framework for galaxy formation and evolution in the young Universe. Galaxies formed as baryonic gas cooled at the centres of collapsing dark-matter haloes; mergers of haloes and galaxies then led to the hierarchical build-up of galaxy mass. It remains unclear, however, over what timescales galaxies were assembled and when and how bulges and disks - the primary components of present-day galaxies - were formed. It is also puzzling that the most massive galaxies were more abundant and were forming stars more rapidly at early epochs than expected from models. Here we report high-angular-resolution observations of a representative luminous star-forming galaxy when the Universe was only 20% of its current age. A large and massive rotating protodisk is channelling gas towards a growing central stellar bulge hosting an accreting massive black hole. The high surface densities of gas, the high rate of star formation and the moderately young stellar ages suggest rapid assembly, fragmentation and conversion to stars of an initially very gas-rich protodisk, with no obvious evidence for a major merger.