If you're having trouble getting your key to turn in the ignition, you could be dealing with one of a handful of issues. Assuming you didn't accidentally hop into someone else's car, there could be a problem with the key or the lock cylinder. If a key is worn or damaged, you'll need to get a new one from the manufacturer.
How does the lock cylinder work?
The ignition will only be activated under the correct conditions. The ridges on your car keys depress small levers inside the lock cylinder, which will only accept the key if it matches a specific pattern. Inside the cylinder, there is a tumbler that begins to turn once the levers, known as key followers, are in the right place so they come into contact with springs. Each spring is loaded to react at one certain pressure, and the levers are aligned to deliver that exact payload. A worn key may not be able to provide the correct pattern to engage the ignition, the springs can fail or the key followers might not be operative.
What could be wrong with the cylinder?
Over time, the key or the cylinder can wear out or become damaged enough that the patterns don't line up properly. In this case, you might need to replace whichever part is problematic. If the lock cylinder has been altered, a locksmith may also be able to make a new key that will fit the cylinder's current alignment. The lock cylinder could just be jammed in a position where the key cannot properly engage. Just as smacking the side of a vending machine can free your bag of chips, tapping firmly on the face of the lock cylinder can be enough to jolt the stuck cylinder. You can also try flushing the system with an electrical contact cleaner to clear out any debris or dirt that may be jamming the mechanism.
What else may be causing the problem?
When you turned your car off, did you wiggle the steering wheel for any reason? If you did, the movement may have pressure on the lock pin that holds the wheel in place. While trying to turn the key in the ignition, turn the steering wheel back and forth. You may find that a bit of jiggling will allow you to start the car right up. If your vehicle has an automatic transmission, ensure it is in park - some cars will not start if the transmission is in gear. You should also check to ensure your key hasn't been bent. This can affect its ability to properly engage the key followers, but is easy to straighten out by gently tapping it with a hammer and slowly flattening the metal.
Unless you're dealing with a stuck wheel or a jammed lock cylinder, you may be looking at replacing the key or the entire lock cylinder. Bear in mind if you have a new key made to match the cylinder, you will want to hang on to the original one. Chances are the new key won't be able to unlock doors or the trunk of your car, but the old one will. In this case, you should clearly label each key, so you don't have to waste time fumbling for the right one or using the wrong key every time you try to open your door or start the car.