By reduction of the equation $ax + by + c = 0 $ of a straight line to the normal form , we get $$\left(\frac{-a}{\sqrt{a^2 + b^2}}\right)x + \left(\frac{-b}{\sqrt{a^2 + b^2}}\right)y = \frac{c}{\sqrt{a^2 + b^2}}$$ And, $$p= \frac{∣c∣}{\sqrt{a^2 + b^2}}$$ And my textbook says that $p$ is the distance of the straight line from the origin. I don't know why we are getting it as a distance from origin?
I know $p= x\cos\theta + y\sin\theta$ ( where $p$ is distance of line from origin).
Also I want to know how can we relate both equations?
There is a simple derivation of what you want to know. Without going into details, let me introduce the result:
Since you want distance of line from origin, the coordinates become $(0,0)$ and hence the perpendicular distance of a line from origin is $|\frac{Ax'+By'+c}{\sqrt{A^2+B^2}}|=|\frac{0+0+c}{\sqrt{A^2+B^2}}|=|\frac{c}{\sqrt{A^2+B^2}}|$.