This is a common problem that can be caused by a couple of things. Some people call this "dieseling" or "run-on". What is happening is; when you shut the ignition off, something, somehow is causing a couple of the cylinders to keep igniting, which in turn keeps the engine running, although "sputtering" pretty badly. This can be caused by excessive carbon build-up in the combustion chambers or on the piston tops which when hot, acts like little glow plugs. This is common on engines that run way too rich or have oil burning problems. Dieseling is a common problem with high compression / high performance engines, especially in warm weather or when the engine is hot. In this case, it is usually caused by running "cheap" gas with inadequate octane. In this case it can usually be remedied by switching to a higher octane fuel.
In milder street engines, another big cause for engine run-on is having the idle set too high, or the carb is misadjusted which requires the idle speed screw to be screwed-in too far to allow the engine to idle. When the idle screw is screwed-in too far, it opens the throttle plates too wide and actually pulls fuel through the main jets a little, so when you shut the engine off, the inertia of the spinning engine still pulls air (and some fuel) through the carb and into the cylinders and the heat built-up inside the combustion chambers is enough to light a few of the cylinders at random to keep the engine spinning and sputtering. Again, this is especially true with fuel that isn't high enough in octane. The more the octane, the less volatile the fuel. Even though the key is off, the engine won't stop sputtering because the throttle plates are opened up enough to still pass a little fuel and air. This is why more modern cars with carburetors (mostly 80's and early 90's cars) had idle stop solenoids that completely close the throttle plates off when the key is switched-off which completely shuts the fuel and air off, thus preventing run-on from happening. With an idle stop solenoid, when you turn your key on, it clicks into position which pushes the throttle linkage to the normal "idle" position, but when switched-off, it allows the throttle to completely close-off.
Fuel injected cars don't have any Dieseling or run-on problems because the fuel is electronically pushed to the injectors via an electric fuel pump, and the injectors electronically fire, so with the key off, the fuel delivery completely stops. Carburetors aren't electric, so even when you shut off the ignition, the inertia of the engine still rotating is still sucking-in a little air and fuel, and as long as it is still rotating, the fuel and air is still flowing just enough through that carb to feed a couple of the cylinders. Even though the ignition is off, hot carbon in the cylinders can continue to ignite that fuel.
There is another way to remedy this other than installing an idle stop solenoid, which involves the vacuum advance and the ignition timing. Even though the timing has nothing to do with engine run-on, (because the key is turned off and "ignition timing" is no longer in play), timing DOES affect the engine's idle when it's running. You can experience this when setting your timing at an idle. If you advance the timing - the idle goes up. If you retard the timing - the idle drops. You can manipulate the idle speed by using the vacuum advance by hooking it uo to manifold vacuum which will pull more timing (advance) at an idle, thus causing the idle to go up a couple of hundred RPM. Once this happens, you can back down the idle speed screw a bit which will drop the idle back down to a normal RPM. Because you just closed-off the throttle plates more than they were before hooking-up the vacuum advance to manifold vacuum, when you turn the key off now, the plates are closed enough to no longer pass enough fuel and air to allow the engine to run-on and sputter. Some will say this will add too much overall timing to the engine when running around and driving, but this isn't so true because when you are on the throttle, the vacuum signal drops and puts you back to normal "mechanical" timing. if you romp the throttle hard, your vacuum signal drops to zero, so now the vacuum advance and additional timing isn't in play at all. It's a remedy, but like all remedies, it may not be a perfect solution. It works most of the time for most people, but to find-out, it only takes about 3 minutes, a piece of 50 cent vacuum line, and a screwdriver to see if it works for you or not.
If you don't want to mess with any of that, then there is still an easy option. In cars equipped with automatic transmissions, you can simply shut the engine off while still in "Drive" and the load from the tranny will cause the engine to shut right off. Manual transmission cars can be shut off while in gear (with the clutch pedal down) and then letting the pedal back up slowly when the key is turned off to load the engine a little, thus not allowing it to run-on. Really though, the two best ways are either to install an idle stop solenoid, or use your vacuum advance hooked-up to manifold vacuum and then re-adjust your idle speed so it idles back down to a normal RPM.