The electron gun generates the electron beam. It is usually positioned in the top of the instrument column. In the image sequence below the gun assembly is lifted off and moved aside to show how the electron emitter is replaced. The emitter is seated within a cone-shaped Wehnelt cylinder and the beam travels out of the small central hole shown in the apex of the cone. Details about the electron gun can be found in the SEM module here and here.
This is an electron gun with the Wehnelt cylinder removed to show the filament within. This is a tungsten filament.