One theory is that the Sun and its planetary system were born in a dense cluster. As the stars move around, they can encounter the each other & their gravity works perturbs each other.
If the Sun had a close flyby from another star out of plane, then that may have warped the protoplanetary disk, changing its angle relative to the young Sun’s rotation axis.