Based on a one-zone evolution model of grain size distribution in a galaxy, we calculate the evolution of infrared spectral energy distribution (SED), considering silicate, carbonaceous dust, and polycyclic aromatic hydrocarbons (PAHs). The dense gas fraction ($eta_mathrm{dense}$) of the interstellar medium (ISM), the star formation time-scale ($tau_mathrm{SF}$), and the interstellar radiation field intensity normalized to the Milky Way value ($U$) are the main parameters. We find that the SED shape generally has weak mid-infrared (MIR) emission in the early phase of galaxy evolution because the dust abundance is dominated by large grains. At an intermediate stage ($tsim 1$ Gyr for $tau_mathrm{SF}=5$ Gyr), the MIR emission grows rapidly because the abundance of small grains increases drastically by the accretion of gas-phase metals. We also compare our results with observational data of nearby and high-redshift ($zsim 2$) galaxies taken by textit{Spitzer}. We broadly reproduce the flux ratios in various bands as a function of metallicity. We find that small $eta_mathrm{dense}$ (i.e. the ISM dominated by the diffuse phase) is favoured to reproduce the 8 $mu$m intensity dominated by PAHs both for the nearby and the $zsim 2$ samples. A long $tau_mathrm{SF}$ raises the 8 $mu$m emission to a level consistent with the nearby low-metallicity galaxies. The broad match between the theoretical calculations and the observations supports our understanding of the grain size distribution, but the importance of the diffuse ISM for the PAH emission implies the necessity of spatially resolved treatment for the ISM.