How a transistor means NOT?
I'm not going to explain what is a transistor, you can read that from Wikipedia. What I will try to do, is explain how transistor becomes a logic operator. To be more accurate, it will become a NOT-operator. NOT and it's functionality is described in previous post.
Here is a basic transistor drawn as circuit diagram:
If you have no experience on circuit diagrams, just imagine that lines mean wire which connects things, the zigzag is a resistor, and that triangle look-a-like made of lines is ground. Ground means that it will eat up all your electricity: voltage in everything where the ground is connected will drain to 0. Vcc is +voltage (it should always be there or the transistor won't work), and Vin / Vout are the wires we are interested. Everything else is just unnecessary details, so don't worry if you don't understand anything else.
The blue vertical line (base) is "the thing" in transistor. When we put voltage there by Vin, it will start to conduct, otherwise it won't.
So, when there is no voltage in Vin, the transistor actually looks like this:
If we do have voltage there, the 'base' starts to conduct. Vcc and Vin are then connected to ground, so there will be nothing going to Vout. Like this:
If you wonder why we need the resistor, it's because it prevents short circuit between Vin and Vcc (resistor limits the current going through). Another point is that Vcc might have smaller resistance than Vout which causes the current to go to Vcc → the output voltage wouldn't change.