The glass envelope of a bulb is filled with nitrogen and argon gas to prevent the filament from reacting with oxygen in the air at high temperatures.
When the bulb is turned on, the filament heats up and emits light. If the glass envelope is filled with air, the oxygen in the air will react with the hot filament and cause it to burn out quickly. This is why the bulb is filled with nitrogen and argon gas instead, which are inert gases that do not react easily with other elements.
Nitrogen and argon are also used because they are good insulators, which helps to protect the filament and maintain the temperature inside the bulb. They are also non-toxic and non-flammable, making them safe to use in a variety of lighting applications.