To study the dust evolution in the cosmological structure formation history, we perform a smoothed particle hydrodynamic simulation with a dust enrichment model in a cosmological volume. We adopt the dust evolution model that represents the grain size distribution by two sizes and takes into account stellar dust production and interstellar dust processing. We examine the dust mass function and the scaling properties of dust in terms of the characteristics of galaxies. The simulation broadly reproduces the observed dust mass functions at redshift $z = 0$, except that it overproduces the massive end at dust mass $M_mathrm{d} gtrsim 10^{8}$ ${rm M}_odot$. This overabundance is due to overproducing massive gas/metal-rich systems, but we also note that the relation between stellar mass and gas-phase metallicity is reproduced fairly well by our recipe. The relation between dust-to-gas ratio and metallicity shows a good agreement with the observed one at $z=0$, which indicates successful implementation of dust evolution in our cosmological simulation. Star formation consumes not only gas but also dust, causing a decreasing trend of the dust-to-stellar mass ratio at the high-mass end of galaxies. We also examine the redshift evolution up to $z sim~ 5$, and find that the galaxies have on average the highest dust mass at $z = 1-2$. For the grain size distribution, we find that galaxies with metallicity $sim 0.3~ Z_odot$ tend to have the highest small-to-large grain abundance ratio; consequently, the extinction curves in those galaxies have the steepest ultraviolet slopes.