The "thud" sound you hear when turning on certain lights, such as fluorescent lights, is typically associated with the ballast, which is a device used to regulate the electrical current flowing through the light.
In fluorescent lights, the ballast is responsible for starting and maintaining the electrical discharge in the gas inside the light tube. When you turn on the light, the ballast rapidly increases the voltage and current to create an initial high-energy discharge across the electrodes inside the tube. This discharge creates an arc of electricity that ionizes the gas, allowing it to emit ultraviolet light.
The "thud" sound is produced by the ballast as it energizes and delivers a high voltage to initiate the discharge. It can be a result of mechanical vibrations or the electrical components within the ballast.
It's worth noting that not all types of lights produce this sound. For example, LED lights do not have ballasts and therefore do not generate a "thud" sound when turned on.