What causes axial tilt?
Two factors: the initial tilt provided by the nebulae that formed the solar system and any subsequent impact by planetoids.
When the solar system is forming, gravity tends to attract lumps of matter together that later form planets. However, this eventually gives the early solar system a rotational spin. All planets in our solar system revolve around the sun in the same direction. If a planet forms without any subsequent impact, the axial tilt is pretty much a random factor.
However, if like Earth, an early forming planet gets smacked by another smaller forming porto-planet, this can cause the axial tilt to flip further. For example, Uranus, is tilted about 83 degrees or almost spinning on its side!