Basically you want the matrix to be invertible over $\mathbb{F}_p$. In order for the matrix to be invertible, you want the columns of the matrix to be $\mathbb{F}_p$-linearly independent.
For the first column, you can choose any nonzero vector in $\mathbb{F}_p^2$ (which has order $p^2$), so you have $p^2-1$ choices. For the second column, you can't choose any multiple of the first column. There are exactly $p$ such multiples, so you now have $p^2-p$ choices for the second column.
Since you have $p^2-1$ choices for the first column and $p^2-p$ choices for the second column, the total number of invertible matrices is $$(p^2-1)(p^2-p) = p^4-p^3-p^2+p.$$
Note that this argument can be generalized to prove that the total number of invertible $n \times n$ matrices over $\mathbb{F}_p$ is equal to $(p^n-1)(p^n-p)(p^n-p^2) \cdots(p^n-p^{n-1})$.