we can explain this with the help of VSEPR theory
It is used to predict the shape of individual molecules based upon the extent of electron-pair electrostatic repulsion.The premise of VSEPR is that the valence electron pairs surrounding an atom mutually repel each other, and will therefore adopt an arrangement that minimizes this repulsion, thus determining the molecular geometry.
In case of octahedral geometry.
if we replace two bonds with lone pairs of electrons, the lone pairs must be added on opposite sides because of their more powerful magnetic force - they push harder. This gives us a distorted molecular geometry where we have 4 bonds in a single plane, so we call it square planar shape where the angles all equal 90°.