PWM with LED and Potentiometer for Brightness/Intensity

Hi, I am learning to use arduino and I made a PWM circuit with a led and a potentiometer to regulate the intensity of the brightness of the led.
I would like to know why when connecting it this way the circuit as in the first photo the circuit does not work but when connecting it as in the second photo it does work, in theory it is not the same?

In the upper circuit, how does the pot get power and ground?

The top and bottom power buses are not connected unless you connect them.

Ahhhhh, the tension rails are not interconnected?

Sorry for my bad English, I'm using the translator xD

No, they are not. Connect them like so:
connect power buses