The presence of multiple stellar populations in globular clusters is now well accepted, however, very little is known regarding how they formed. Answering this question is one of the major challenges of stellar astrophysics, yet of great interest, given the importance of globular clusters in different fields, from stellar evolution to gravitational wave emission and galaxy assembly. We present a series of 3D hydrodynamic simulations both of isolated clusters and at a cosmological scale aimed at probing the formation of globular clusters and their multiple stellar populations. We focus first on the effects of both rotation and Type Ia supernovae on the formation of the second population with particular attention on the chemical composition of the newborn stars. Then, we present the first simulations of the SImulating the Environment where Globular clusters Emerged project aimed at probing the formation of globular clusters through sub-parsec cosmological zoom-in simulations.