If, hypothetically, you were to turn your car’s ignition cylinder to the off position and remove the key, your car’s engine would shut off immediately. Of course, due to the laws of physics, all of the kinetic energy your car is constantly moving cannot dissipate and stop you from dying.
When the engine is turned off, it stops taking in oil, but any oil in it keeps the pistons moving for a long time, pushing them forward until the piston stops. Additionally, your car’s engine or battery does not power your steering and brakes, so they have limited control. Basically, if you stop a car while driving, it stops being a car and becomes a trailer.
Incidentally, if your car has a wireless fob that, by accident, leaves the car, it won’t affect anything. Most cars that use this system have built-in failsafes that keep the car running even when the fob is moved too far or the stop button is pressed. If you stop the car, you may need the fob to start it again, but it’s a hassle.