BJT Switch with a Diode from Base to Emitter
Real diodes will allow some small leakage current even before they're 'properly' forward-biased.
This leakage current is apparently enough to turn your transistor on.
The 330 ohm resistor shunts this leakage to ground and so keeps the transistor off until you have a high enough voltage to properly forward-bias the diode.