Object rotates on its side on play

Hi, I have been making this game where you drive your car around a planet, I use gravity to attract the car to the planet, but the problem is when I press play my car turns on its side, why is this happening?

Here is the planet script:

public class planetScript : MonoBehaviour
   public float gravity = -12;
   void Start(){
   GetComponent<Rigidbody>().constraints = RigidbodyConstraints.FreezeAll;
   public void Attract(Transform playerTransform){
       Vector3 gravityUp = (playerTransform.position - transform.position).normalized;
       Vector3 localUp = playerTransform.up;

       playerTransform.GetComponent<Rigidbody>().AddForce(gravityUp * gravity);

      Quaternion targetRotation = Quaternion.FromToRotation(localUp,gravityUp) *  playerTransform.rotation;
       playerTransform.rotation = Quaternion.Slerp(playerTransform.rotation, targetRotation, 10f * Time.deltaTime);

And here is the car gravity script:

public class playerGravity : MonoBehaviour
    public planetScript attractorPlanet;
    private Transform playerTransform;
    void Start()
        GetComponent<Rigidbody>().useGravity = false;
        GetComponent<Rigidbody>().constraints = RigidbodyConstraints.FreezeRotation;

        playerTransform = transform;

        void FixedUpdate()

For anyone having the same problem, I have managed to fix the problem by changing the line:
Quaternion targetRotation = Quaternion.FromToRotation(localUp,gravityUp) * playerTransform.rotation;


Quaternion targetRotation = Quaternion.LookRotation(gravityUp,Vector3.up);