No picture is attached.
If "spinning endlessly" means it rotates through more than 360 degrees then a normal MG996R simply cannot do that. So either you have a continuous rotation version rather than a standard servo or you have a faulty servo.
Generally the same code will drive a standard SG90 and a standard MG996R though it is possible the angles may need to be adjusted slightly. The MG996R also needs a lot more current so swapping them over can cause problems if whatever battery/power supply you're powering the car with is overloaded.
Steve