The idea of an envelope to shape sounds comes from Helmholtz, a great mind famous for his equations. The ADSR, as we know it today, comes from Moog, a pioneer in synthesizer design. The envelope Generator is probably the most important module in a synthesizer as it enables to make sounds feel like they are coming from real instruments.
When the keyboard detects that a key is being pressed, it turns on the GATE signal, which tells the synth to start the envelope (attack) for that key (and associated sound). When the key is depressed, the keyboard turns off the GATE signal, telling the synth to start the release part of the envelope.
Above is what you see when you go into SYNTH EDIT for synth1 or synth2. In this post, we focus on the EG (Envelope Generator) controls.
The ATTACK knob controls the time it takes to go from 0 to peak level. If set all the way to the left, there is no attack and the sound goes straight to the decay phase.
The DECAY knob controls the time it takes to go from peak level to sustain level (always lower than or equal to the peak). If turned all the way to the left, there is no decay and the sound goes straight to the sustain phase.
The SUSTAIN knob controls the level of the sustain phase. If all the way to the left, the sustain level is 0 and therefore silent. If all the way to the right, the sustain is at 100%, which means its level is at the peak. Notice that this knob does not control time (as the other knobs) but level.
The RELEASE knob controls the time it takes for the sound to go from the sustain level to 0.
The signal from the Envelope Generator can be used to modulate modules that accept input control voltages (in a voltage controlled analog synth), for instance, the volume (obviously otherwise we would not be able to hear the sound envelope), the pitch, the filters, etc.