There's an error in your schematic, where the D and S labels do not correspond with the MOSFET's drain and source. For this application, the labels are correct, and the MOSFET must be flipped horizontally to be correct. I'll redraw it here, corrected. I'll illustrate the two conditions, \$V_C\$ low (ON) and \$V_C\$ high (OFF):
simulate this circuit – Schematic created using CircuitLab
Here I will call the voltage of Q1's source \$V_S\$, which is always equal to \$V_{IN}\$. At Q1's gate the voltage is \$V_G\$, which is equal to whatever control voltage \$V_C\$ you apply there.
The on/off state of the MOSFET is determined by the the difference between the voltage at the gate, and the voltage at the source. This quantity is called \$V_{GS}\$, where \$V_{GS} = V_G - V_S\$.
For P-channel MOSFETs \$V_{GS}\$ must be very negative for the MOSFET to be switched on (saturated), or close to zero to be switched off.
As you can see, on the left, when the gate is connected to a voltage much lower than the source, the difference is:
$$\begin{aligned}
V_{GS} &= V_G - V_S \newline
&= 0V-(+12V) \newline
&= -12V
\end{aligned}$$
This is very negative, and easily enough to switch Q1 on, which becomes very conductive. Effectively Q1 connects \$V_{IN}\$ to \$V_{OUT}\$.
On the right, though, the gate is held at a voltage close or equal to \$V_{IN}\$, resulting in:
$$\begin{aligned}
V_{GS} &= V_G - V_S \newline
&= +12V-(+12V) \newline
&= 0V
\end{aligned}$$
This is insufficient to switch Q1 on, and the resulting high impedance between Q1's source and drain means that \$V_{OUT}\$ is effectively disconnected from \$V_{IN}\$.