Arduino Uno not running properly when powered via USB on Laptop

You might like to use the on board LED that is driven by digital pin 13 as your output led. Simpler.

I ran your sketch using pin 13. LED comes on when pin 2 not connected to anything, goes out when connected to GND. No reaction to me touching the wires. Same behaviour whether powered by USB or power pack.

The reference material on Digital Pins is worth reading (explore INPUT_PULLUP).

Perhaps you have a flaky USB connector on the laptop. Is the laptop battery drained?

Be patient. Developing a project is always an ongoing process of getting over hurdles. Good luck.