How is the denominator in one sample Z test of proportion derived? Formula for Z statistic in One sample Z test of proportion is:

How the denominator is derived?

The denominator is the standard deviation of the sampling distribution, which is known as the standard error. Standard error, at least under the assumptions of the z-test, is equal to the population standard deviation divided by the square root of the sample size.
For the proportion variable you are considering, calculus shows the variance to be $p_0(1-p_0)$. Therefore, the standard deviation is $\sqrt{p_0(1-p_0)}$. Then we divide by the square root of the sample size to get $\dfrac{\sqrt{p_0(1-p_0)}}{\sqrt{n}} = \sqrt{\dfrac{p_0(1-p_0)}{n}}$.
