This article is from the Problem Behaviors in Cats FAQ, posted to rec.pets.cats newsgroup. Maintained by Cindy Tittle Moore with numerous contributions by others.
The best way to prevent this problem is to get a garbage container with a firm lid. Do NOT start with container that's trivial to get into, then gradually move to harder and harder containers: this just trains the cat to get into the harder container. A hospital type of container that opens the lid with a foot pedal is effective and convenient. Another is the kind with metal handles that swing up to close the lid. The important thing is the lid is tight and secure.
Another way to prevent this is to store the garbage can out of reach, such as in the cabinet under the sink or in a pantry where the door is kept closed. If the cat can open the cabinet door, get a childproof latch for it.
If the problem is one of tipping the container over, several bricks in the bottom of the container may help stabilize it. Once the cat is convinced it can't be knocked over, you can remove the weight.