If you leave any of the inputs disconnected the voltage on that input is undefined.
CMOS logic gates have a very high input impedance. The pins on an unconnected input can act like an aerial and pick up noise (static electricity, induced voltage from the 50/60Hz mains or even radio waves). The results are unpredictable, the logic gate may well amplify this noise or treat it as a logic 1 or 0 causing the LED on the output to light up.
It's quite possible the LED is flashing at 50 or 60Hz or trying to flash at radio frequencies!
When you connect the inputs to 0V (or VCC) with a wire you not only force the input to be a logic 0 (or 1) but you also change the impedance of the input node and this stops the input picking up noise.
When you design a circuit all unused/spare inputs should be connected to 0V or VCC.