Various locomotion strategies employed by microorganisms are observed in complex biological environments. Spermatozoa assemble into bundles to improve their swimming efficiency compared to individual cells. However, the dynamic mechanisms for the formation of sperm bundles have not been fully characterized. In this study, we numerically and experimentally investigate the locomotion of spermatozoa during the transition from individual cells to bundles of two cells. Three consecutive dynamic behaviors are found across the course of the transition: hydrodynamic attraction/repulsion, alignment, and synchronization. The hydrodynamic attraction/repulsion depends on the relative orientation and distance between spermatozoa as well as their flagellar wave patterns and phase shift. Once the heads are attached, we find a stable equilibrium of the rotational hydrodynamics resulting in the alignment of the heads. The synchronization results from the combined influence of hydrodynamic and mechanical cell-to-cell interactions. Additionally, we find that the flagellar beat is regulated by the interactions during the bundle formation, whereby spermatozoa can synchronize their beats to enhance their swimming velocity.