Recent high-quality Hubble Space Telescope photometry shows that the main-sequence stars of young star clusters form two discrete components in the colour-magnitude diagram. On the basis of their distribution in the colour-magnitude diagram, we show that stars of the blue main-sequence component can be understood as slow rotators originating from stellar mergers. We derive the masses of the blue main-sequence stars, and find that they follow a nearly flat mass function, which supports their unusual formation path. Our results imply that the cluster stars gain their mass in two different ways: by disk accretion leading to rapid rotation, contributing to the red main sequence, or by binary merger leading to slow rotation, populating the blue main sequence. We also derive the approximate merger time of the individual stars of the blue main-sequence component, and find a strong early peak in the merger rate, with a lower-level merger activity prevailing for tens of millions of years. This supports recent binary-formation models, and explains new velocity dispersion measurements for members of young star clusters. Our findings shed new light on the origin of the bimodal mass, spin and magnetic-field distributions of main-sequence stars.