A phenomenological theory describing the second harmonic generation (SHG) in optical fibers is presented. The SHG phenomenon is explained as a result of a photoelectric convective instability leading to spontaneous formation of chi(2) grating. It is shown that spontaneous SHG is due to stationary amplification of noise. The theory explains the observed strong fluctuation of the output harmonic signal and the spatial location of the chi(2) grating. it is shown that the region where the chi(2) grating is written is not restricted by the coherence length determined by the walk-off or self-phase modulation effects. Saturation of SHG due to nonlinearity is studied. New effects in SHG dynamics are predicted which could be checked experimentally.