Galaxy Formation and Chemical Evolution in Hierarchical Hydrodynamical Simulations