
By the definition we have PF=PD. Using the distance formula this condition becomes
$\sqrt{x^2+(y-p)^2}=y+p$
How is this derived from the "distance formula" ?
Distance formula is defined as distance between two points $P_1$ and $P_2$: $\sqrt{(x_1-x_2)^2+(y_1-y_2)^2}$
Note that in your figure you have the vertex of the parabola in $(0,0)$ and the directrix is the straight line $ y=-p$, so your parabola is symmetric with respect the $y$ axis. This particular position and symmetry is used to derive the equation.
To explicitly see the use of distance formula you can write: $$ P\equiv (x_P,y_P)=(x,y) $$ because it is a generic point on the plane. $$ D\equiv (x_D,y_D)=(x,-p) $$ $$ F\equiv (x_F,y_F)=(0,p) $$ because the vertex $V\equiv (0,0)$ must be at the same distance from $F$ and the directrix (by definition of parabola).
So, using the distance formula you find: $$ PF=PD \iff \sqrt{(x-0)^2+(y-p)^2}=\sqrt{(x-x)^2+(y-(-p))^2} $$
that is your equation.