Internal chemical abundance spreads are one of fundamental properties of globular clusters (GCs) in the Galaxy. In order to understand the origin of such abundance spreads, we numerically investigate GC formation from massive molecular clouds (MCs) with fractal structures using our new hydrodynamical simulations with star formation and feedback effects of core-collapse supernovae (SNe) and asymptotic giant branch (AGB) stars. We particularly investigate star formation from gas chemically contaminated by SNe and AGB stars ('self-enrichment') in forming GCs within MCs with different initial conditions and environments. The principal results are as follows. GCs with multiple generations of stars can be formed from merging of hierarchical star cluster complexes that are developed from high-density regions of fractal MCs. Feedback effects of SNe and AGB stars can control the formation efficiencies of stars formed from original gas of MCs and from gas ejected from AGB stars. The simulated GCs have strong radial gradients of helium abundances within the central 3 pc. The original MC masses need to be as large as 10(7) M-circle dot for a canonical initial stellar mass function (IMF) so that the final masses of stars formed from AGB ejecta can be similar to 10(5) M-circle dot. Since star formation from AGB ejecta is rather prolonged (similar to 10(8) yr), their formation can be strongly suppressed by SNe of the stars themselves. This result implies that the so-called mass budget problem is much more severe than ever thought in the self-enrichment scenario of GC formation and thus that IMF for the second generation of stars should be 'top-light'.