When docking to a station with an entity you will get forced into the stations alignment and out of alignment and gravity of the docked entity.
to illustrate:
{F767}
to reproduce
1. setup a station with a dock upside down on the underside
2. dock a taller ship to that dock and get into gravity and or alignment at the end of that ship
3. if you not already got reoriented move toward the station
4. at one point you will be switched to the station orientation