Context. The origin of the stellar spin distribution at young ages is still unclear. Even in very young clusters (∼ 1 Myr), a significant spread is observed in rotational periods ranging from 1 to ∼ 10 days. Aims. We aim to study the parameters that might govern the spin distribution of low mass ( 1.0 M ) stars during the first million years of their evolution. Methods. We compute the evolution and rotational periods of young stars, using the MESA code, starting from a stellar seed, and take protostellar accretion, stellar winds, and the magnetic star-disk interaction into account. Furthermore, we add a certain fraction of the energy of accreted material into the stellar interior as additional heat and combine the resulting effects on stellar evolution with the stellar spin model. Results. For different combinations of parameters, stellar periods at an age of 1 Myr range between 0.6 days and 12.9 days. Thus, during the relatively short time period of 1 Myr, a significant amount of stellar angular momentum can already be removed by the interaction between the star and its accretion disk. The amount of additional heat added into the stellar interior, the accretion history, and the presence of disk and stellar winds have the strongest impact on the stellar spin evolution during the first million years. The slowest stellar rotations result from a combination of strong magnetic fields, a large amount of additional heat, and effective winds. The fastest rotators combine weak magnetic fields and ineffective winds or result from a small amount of additional heat added to the star. Scenarios that could lead to such configurations are discussed. Different initial rotation periods of the stellar seed, on the other hand, quickly converges and do not affect the stellar period at all. Conclusions. Our model matches up to 90% of the observed rotation periods in six young ( 3 Myr) clusters. Based on these intriguing results, we motivate to combine our model with a hydrodynamic disk evolution code to self-consistently include several important aspects such as episodic accretion events, magnetic disk winds, internal, and external photo-evaporation. Such a combined model could replace the widely-used disk-locking model during the lifetime of the accretion disk and provide valuable insights into the origin of the rotational period distribution of young clusters.