We analyse the mass assembly of central galaxies in the EAGLE hydrodynamical simulations. We build merger trees to connect galaxies to their progenitors at different redshifts and characterize their assembly histories by focusing on the time when half of the galaxy stellar mass was assembled into the main progenitor. We show that galaxies with stellar mass $M_*<10^{10.5}M_{odot}$ assemble most of their stellar mass through star formation in the main progenitor (`in-situ star formation). This can be understood as a consequence of the steep rise in star formation efficiency with halo mass for these galaxies. For more massive galaxies, however, an increasing fraction of their stellar mass is formed outside the main progenitor and subsequently accreted. Consequently, while for low-mass galaxies the assembly time is close to the stellar formation time, the stars in high-mass galaxies typically formed long before half of the present-day stellar mass was assembled into a single object, giving rise to the observed anti-hierarchical downsizing trend. In a typical present-day $M_*geq10^{11}M_{odot}$ galaxy, around $20%$ of the stellar mass has an external origin. This fraction decreases with increasing redshift. Bearing in mind that mergers only make an important contribution to the stellar mass growth of massive galaxies, we find that the dominant contribution comes from mergers with galaxies of mass greater than one tenth of the main progenitors mass. The galaxy merger fraction derived from our simulations agrees with recent observational estimates.