This question is for Piper Tomahawk, but I guess applies to any small aircraft.
Why do we need to use the fuel mixture to starve the engine before turning it off with the key? Why can't we just turn it off with the key like in a car?
The reason is the large spinning thing on the front. Residual fuel in the engine has been known to auto-ignite (i.e. combust without a spark), causing the prop to spin, causing serious injuries and deaths. A lean cutoff reduces the risk that someone handling the prop will get maimed or killed.
In a car when you turn the engine off usually it is in park or neutral, so if the engine turns a few revs the car goes nowhere, even if it is in gear the car may lurch but that's generally it. Modern car engines have electronic fuel injection and electric fuel pumps, some modern push-button gasoline engines are stopped by performing a lean cut-off, turning off the injectors before the plugs, most work by just stopping ignition. Diesels don't have spark plugs, they rely on compression alone, so cutting off fuel is the only way to stop them.
Combustion in a gasoline internal combustion engine for most aircraft, requires four things: fuel, oxygen, compression and ignition.
If the engine is starved of fuel, accidental combustion (and an accidental spinning prop) will not happen. So shutting off the fuel is one way to prevent accidental "start" if even for one stroke.
Oxygen is ubiquitous and is not practical to eliminate from the engine environment.
Compression can happen when someone intentionally or unintentionally moves the prop, which coupled to the crankshaft may cause a cylinder to go through a compression stroke. Since frequently props are moved to place cowl plugs, attach tow bars, etc. the risk of a partially rotating prop is non-zero.
Ignition happens in many forms. Hot carbon deposits, hot spark plugs, nicks in pistons are all sources of continued ignition when trying to shut down an engine. Removing fuel eliminates these sources of ignition from causing continued rotation of the engine.
The most significant source of ignition in most aircraft gasoline engines is the magnetos which are used to energize the spark plugs. Magnetos are effective at creating energy even at low rotational velocities. Many aircraft engines also have "impulse" magnetos, which are spring loaded, and trigger on a very low rotational velocity. They have the advantage of being effective starting aids. Furthermore, magnetos, while switchable, are normally "grounded" to disable them. There is significant history that broken or intermittent magneto switches, broken or intermittent wires and other causes are responsible for unintended engine starts or undesired engine firings.
To relate a story which happened at a local airport several years ago. A ferry pilot brought a plane to town at night, tied it down at the rural airport, and was to meet the prospective buyer the next morning. The buyer arrived at the strip early the next morning, and while waiting for the ferry pilot, poked around the locked plane. Eventually something possessed him to rotate the prop through manually. Normally that would not have been a problem, except the magneto switch in the aircraft was "open" in the off position, which meant that both magnetos were hot. This was likely not noticed because not everyone does a magneto "ground" check in the off position during their run-up process. However, if the mixture idle-cutoff were in the cutoff position, there would not be fuel available in the carburetor to ignite, except for some reason (such as the ferry pilot extracting his RON bag in the dark) the mixture was nearly full rich. Normally this might have resulted in the engine firing, or even starting and idling. Again, this morning, things were not normal. The RON bag, extracted in darkness by the ferry pilot not only had bumped the mixture control, but also the throttle, so the aircraft engine faithfully roared to full power. Fortunately the startled prospective buyer did not get hit by the spinning prop. However, again, this was an unusual morning. As the engine roared to life, the tiedown on the right wing broke, and the plane pivoted on the left tiedown and swung approximately 180 degrees until the prop was buried into the fuel tank of an adjacent Cessna. Av gas was all over the place. One thing went right that morning, in that the avgas did not ignite and there was no fireball. Unfortunately, the day was not over, yet. After missing the spinning prop and not getting butchered by the surprise of his life, and then dodging a partially freed airplane, the buyer watched in horror as 40 gallons of avgas was sprayed over a running engine, as it came to a somewhat abrupt stop, the prop buried in someone else's wing. At that point he started running up the hill to the FBO to get help, and collapsed to the ground and died of a heart attack.
True story, and this is one that my students, private, commercial and certainly CFI, have all heard. If it helps reinforce engine safety, and understanding shutdown and operational procedures, it is worth the time telling it.
It's done for two reasons:
Engines like the Continental A-65 used in Cubs and Champs in the 40s and 50s didn't have mixture controls or idle cutoffs (full rich all the time) and were shutoff by turning off the mags. If a cylinder had a lot of carbon/lead deposits, it would keep running intermittently kadunk kadunk kadunk.
When you are flying floats there ARE times when you shut down with the ignition, when approaching the dock and you need the engine to stop NOW and can't wait for the idle cutoff to work. Normally you time it with the idle cutoff so the engine has stopped before you have to climb out to step off, but sometimes you can't wait.
Another reason to shut down an engine with the carb in an dry state is you do not know how long it will be before the engine gets started again. A dry carb can sit idle almost forever without suffering ill effects but a wet carb will be subject to fuel spoilage/jet plugging and corrosion from water.
This isn't an issue for a carb that is run daily or even once a week.
This is a basic question that should be covered by your ground school, flight instructor and your primary training. The vast majority of certified piston-engine airplanes have two (redundant) magnetos for ignition. The mag switch in OFF position grounds the magnetos so they don't produce a spark even when they are turning (like if you pull the prop through a 180 degrees.) The ground wires are called P-Leads. If the ignition switch or one or both P-lead should fail (open the ground circuit) the magneto(s) may be "hot", that is, they can produce a spark in the spark plug and ignite any fuel in the cylinders. This will kick the prop over with great force and possibly hit anyone/anything in the prop arc. By pulling the mixture to cutoff position, starving fuel from the engine to shut it down, you greatly reduce the risk of a surprise/unwanted engine start when the prop is next moved. You might just move the prop level to allow attaching your tow bar after flying, or someone may handle the prop for no reason at all (curious children or just idiots at the airport/airshow/fly-in) and if the engine makes a spark and fuel is available (shut-off carb "rich") there could be an injury, death, and resulting lawsuit. Teach your flying guests, especially children, to never touch the prop unless they are certain it is safe. The key may be left on, or the mixture rich, and accidental starting can occur. Your handy pilot's checklist should have "Mixture - idle cutoff" in the "Before Starting" and "Shutdown" sections. Lastly, never leave a nosewheel towbar connected when you are not moving the airplane. It is very easy to forget it before starting the engine, and ANY PROP STRIKE REQUIRES A PROP INSPECTION AND ENGINE TEARDOWN/INSPECTION. Add "Towbar Stowed" to your preflight checklist.