Anytime I've heard the term metagaming the person who mentions it has a big explanation for what it is or how it happens. It's really quite simple, actually. Metagaming is failing to distinguish between what the character being played knows and what the person playing them knows. That's it. There are various examples of metagaming but the definition is just that easy. It ruins role-playing games because it distracts from immersion. Imagination in role-playing games works best when everyone at the table is imagining roughly the same thing and thus interacting with roughly the same story and environment. Metagamers aren't imagining that environment like they should. They're letting their attention get onto details about the game system being used instead of details about the game being played. Outlined below are examples of metagaming such as monsters, magic, dice, other player's characters and the dungeon master.
Some of the most obnoxious metagaming I have encountered is when players decide their character knows all sorts of unreasonable things about monsters. There's got to be real and decent in-game reasons why someone would know specific things about dragons, ghosts and vampires, for starters. While I agree that some things may very well be common knowledge none of the games I've played had any sort of "adventurer school" before the players began their stories. This is dependent on the campaign itself, too. While in a high fantasy game it's reasonable for people to know some dragons are usually good and others are usually evil it's less acceptable for people in a low fantasy game to know that some dragons breath isn't composed of fire but other elements entirely. Most especially if I'm introducing the monster to the campaign world. Such inappropriate "foresight" takes away from the story because it undermines immersion.
Magic and magical effects are also really bothersome if people metagame with them. Just because someone was raised in a world where magicians exist doesn't mean they know that much about magic. Even a mundane character raised by magicians will be limited in their knowledge. Sudden or ongoing spell effects are a mystery known to those characters who dabble in such arts. Unless a martial character has experienced firsthand the feeling of someone overriding their judgment through illusion or charm they wouldn't be much wiser than "something weird just happened and I believe that person had something to do with it." Here, same as with monster knowledge, the difficulty lies in balancing what the player may know with what the character knows. Because of a competitive edge or whatever else not everyone is good at making the distinction.
Dice, if your game involves them, are another great way for metagaming to occur. I'm not talking about people changing die rolls when you're not looking. If people see that a die roll is really high and they're still not hitting a foe (which should happen only rarely) then they know what their character might not. Games involving dice use them to simulate random effects. When I swing a stick at a friend while we're sparring, I don't comprehend numbers at play so much as I comprehend varying degrees of success and not-success. Dice represent this element of randomness and whatever modifiers are used in such games represent the element of skill involved. Outside of combat people would also use knowledge of the numbers to redo a skill they did poorly on. While making a sword has a basis for comparison, searching and detecting hidden foes most often does not. Metagaming using the numbers on the dice ruins game immersion because it removes drama, suspense and failure from the story. No realistic hero wins at everything always.
One of my players has a strong desire to keep his character sheets hidden. He doesn't want the rest of the party to see what type of character he has, how he designed it and more especially the kind of equipment he has. At first I didn't understand – he is a good gamer, is he trying to hide his skill? No, his strategy is to defend himself from the rest of the party metagaming. The characters he plays, because they're secretive, aren't subject to being micromanaged by the rest of the party. This is another form of metagaming. Sometimes when I would walk around with another friend I was fairly certain he had a pocket knife or multi-tool on him but that's about all I knew. I had no need to go through his backpack and it wasn't automatically assumed that we would have show-and-tell before we started our days, either. Micromanaging other characters is a harmful type of metagaming because people play role-playing games to play their characters, not to let someone else play them. Just because one character has a lot of gold doesn't necessarily mean that the party as a group does.
Perhaps metagaming players at your table annoy you. Maybe you've even been one yourself. There's also the possibility that you are the metagamer at your table and don't see why it's such a bad thing. Well, the DM can also be the culprit of the destruction of fun through metagaming. DMs should be subject to the same rules as the players as far as knowledge goes. Just because they know someone has a unique magic item doesn't mean everyone else in the world should too. Even anyone else shouldn't know unless they have reason to have that knowledge such as being told or going behind the player character's back. When a DM metagames it's often for the same reasons as the player – they don't like to lose. It's very important for both the DM and the players to understand that sometimes they're just going to lose. This typically bears a lot more emphasis (and frequency) for the DM. After all, it's usually on us to help tell the story of how the players rise to power and save the day. A lot of losing on the side of the DM's characters is required for that. DMs should stick by the same no-metagaming rule as the players. Happy not metagaming!