The electronic band structures for AgGaX(2) (X=S, Se, Te) chalcopyrites have been calculated using a pseudopotential total energy method. First-principles calculations of the linear and nonlinear optical properties are presented for these crystals, with the electronic band structures obtained from pseudopotential method as input. The theoretical refractive indices and nonlinear optical coefficients are in good agreement with available experimental values. The origin of the nonlinear optical effects is explained through real-space atom-cutting analysis. The contribution of the GaX(2) group (X=S, Se, Te) for second harmonic generation (SHG) effect is dominant while that of the cation Ag is negligible. In addition, the percentage contribution to the SHG coefficients from the different bonds increase with increase of the bond order.