First-principles calculations have been performed to clarify the differences of the electronic structures of Ga-doped ZnO and ZnS. Results show the local density approximation and local density approximation+U calculations are in good qualitative agreement with each other. After doping, impurity states appear near the Fermi level in both ZnO and ZnS cases. When ZnO is doped, the impurity states are delocalized in the whole conduction band. On the contrary, when ZnS is doped, though the p state of Ga is also delocalized, the s state is localized near the Fermi level. Partial charge density distributions of the frontier orbital show the same information. After an exchange of the crystal structures of ZnO and ZnS, results remain unchanged. The localized Ga s state accounts for the bad electrical properties of Ga-doped ZnS.