Desiring a high-performance infrared (IR) material with a wide band gap and large second harmonic generation (SHG) response motivates the studies about the chemistry and electronic structure of microscopic structures. In this research, the covalence, electronic structure and mechanism of SHG effect for a typical IR system, d10 metal chalcogenides with AB2S4 (A = Cd, Hg; B = Al, Ga) family, were systemically investigated. It reveals that the dp hybridization, size effect and the cation electronegativity induce the changes of band gaps. Besides the decrease of charge-transfer energy enlarging the SHG effect, we found that the strong covalent interaction between atoms is also beneficial to the SHG enhancement. More importantly, the nonlinear optical (NLO) functional units for superior IR performances were investigated, and the results show that IIIA-S functional units have strong covalent interaction and more priority on NLO properties. Furthermore, the electronic structures of sulfur in the compounds are susceptible to the type of cations, and consequently affect the NLO properties.