The origin of scatter in the stellar mass–halo mass relation of central galaxies in the EAGLE simulation