He, ChongChongStar formation is a crucial process that lies at the center of many important topics in astrophysics: the nature of the first sources of radiation, the formation and evolution of galaxies, the synthesis of elements, and the formation of planets and life. Recent advances in computing technology have brought about unprecedented opportunities to deepen our understanding of this complex process. In this dissertation, I investigate the physics of star formation in galaxies and its role in shaping the galaxies and the Universe through numerical simulations.My exploration of star formation begins with a large set of simulations of star cluster formation from isolated turbulent Giant Molecular Clouds (GMCs) with stellar feedback using \ramses{}, a state-of-the-art radiation-magneto-hydrodynamic (radiation-MHD) code. While resolving the formation of individual stars, I have pushed the parameters (mass and density) of the simulated GMCs well beyond the limit explored in the literature. I establish physically motivated scaling relationships for the timescale and efficiency of star formation regulated by photoionization feedback. I show that this type of stellar feedback is efficient at dispersing dense molecular clouds before the onset of supernova explosions. I show that star formation in GMCs can be understood as a purely stochastic process, where instantaneous star formation follows a universal mass probability distribution, providing a definitive answer to the open question of the chronological order of low- and high-mass star formation. In a companion project, I publish the first study of the escape of ionizing photons from resolved stars in molecular clouds into the intercloud gas. I conclude that the sources of photons responsible for the epoch of reionization, one of the most important yet poorly understood stages in cosmic evolution, must have been very compact star clusters, or globular cluster progenitors, forming in dense environments different from today's galaxies. In follow-up work, I use a novel zoom-in adaptive-mesh-refinement method to simulate the formation and fragmentation of prestellar cores and resolve from GMC scales to circumstellar disk scales, achieving an unprecedented dynamic range of 18 orders of magnitude in volume in a set of radiation-MHD simulations. I show that massive stars form from the filamentary collapse of dense cores and grow to several times the core mass due to accretion from larger scales via circumstellar disks. This suggests a competitive accretion scenario of high-mass star formation, a problem that is not well understood. We find that large Keplerian disks can form in magnetically critical cores, suggesting that magnetic braking fails to prevent the formation of rotationally-supported disks, even in cores with mass-to-flux ratios close to critical. This is because the magnetic field is extremely turbulent and incoherent, reducing the effect of magnetic braking by roughly one order of magnitude compared to the perfectly aligned and coherent case, which proposes a solution to the ``magnetic braking catastrophe.''enMULTISCALE RADIATION-MHD SIMULATIONS OF COMPACT STAR CLUSTERSDissertationAstronomyAstrophysicsPhysicsinitial mass functionmagnetohydrodynamicsprotostarsstar clustersstar formation