While there are different kind of function generators which have different modes of generating waveforms, I will tell you how a typical function generator produces sine wave. It all begins with generating a triangle waveform. Yes, all kinds of waveforms can be generated by a triangle wave. This is called as Oscillator source waveform. This is created by continuous charging and discharging of a capacitor. A comparator is used to constrain the output in specific upper and lower bounds. The circuitry (usually current and capacitor size) controls the frequency and amplitude of this source wave.This triangular ramp can now be modified into any of the waveforms by introducing logical circuits into the former. The user can control the output function through the physical interface of the device and particular part of circuit gets activated to create the desired output. The triangular signal is fed into waveform shaping circuit which includes additional diodes/transistors which chip off the peaks and add needed rounded-ness to form a sine waveform estimation.