Autopilot problem

I started directly at the runway.
Before I used to take-off get the plane in the direction of the flight path, select the altitude and then apply auto pilot and it would be fine.
Now when I select auto pilot it’s like the plane wants to return to airport ive just taken off from and then gets into a spin.