The 5W rating seems odd, given it's apparently only accepting current from a single mercury cell, but the relevant value is the resistance. This is a current limiter for the "grain of wheat" bulb, and if the 382 beside the component is the resistance, it'll pass only a couple milliamps. I'm not sure what the rating is on the bulb in this circuit -- neither voltage nor current -- but grain of wheat bulbs are commonly rated for 1 to 1.5 V and a hundred milliamps or so.
However, the other switch visible in that clip may connect to the 9V booster supply, making the lamp available only when the booster is connected and protecting the lamp from excessive current from that supply; 382 ohms would then pass around 25 mA, which is enough to give a yellowish glow from a 100 mA rated bulb, not to mention run the filament cool enough to last virtually forever. The resistor is still massively overrated (a fresh 9V alkaline battery can barely supply 5W when doing nothing else), but too big is better than too small, and the next smaller common rating, 2W, would be too small.