I disagree with some of the definitions that have been posited thus far. Let's step back a little. Here are some definitions, from a non-TRPG perspective:
Game (1): noun. An activity, for recreation or competition, wherein the participants ("players") are challenged to accomplish a given goal and must work within a set of rules to overcome obstacles. Traditionally, to accomplish the goal is to "win" the game.
Metagame (1): noun. "The game around the game." The larger experience of interacting with the game, beyond the actual playing of the game itself.
Examples: Building decks, creating characters, reading about strategies, trading/buying cards, painting minis, talking to other players about the game, coordinating schedules for game night, agreeing on snacks and beverages for the gaming table, etc.
Metagame Knowledge: noun. Information about the metagame, or gained through the metagame, that may become relevant while playing the game.
Examples: I've heard Affinity is the best deck in Standard. My friend Alice likes to combine Laboratory and Throne Room. Ever since that tournament, this one strategy is very popular.
Game (2): verb. To play a game, i.e., to attempt to accomplish the goal by working within the rules. In other words, gaming implies trying to win, using whatever resources are available within the game.
Metagame (2): verb. To game more effectively (i.e., increase likelihood of winning) by using metagame knowledge.
Example: I'm playing StarCraft against my friend Bob. I haven't seen what he's doing yet, but I know he likes to attack very early at the start of the game, so I'd better get my defenses up as soon as possible.
Obviously, nobody complains about metagaming in StarCraft or Magic. It's not considered "cheating," and it's well within the "spirit of the game." So why do we dislike it in TRPGs?
It's because TRPGs don't have the same kind of "goals" and "winning" as in traditional games. To quote the first page of the most recent edition of D&D:
There’s no winning and losing in the Dungeons & Dragons game—at least, not the way those terms are usually understood. Together, the DM and the players create an exciting story of bold adventurers who confront deadly perils. Sometimes an adventurer might come to a grisly end, torn apart by ferocious monsters or done in by a nefarious villain. Even so, the other adventurers can search for powerful magic to revive their fallen comrade, or the player might choose to create a new character to carry on. The group might fail to complete an adventure successfully, but if everyone had a good time and created a memorable story, they all win.
So, in D&D, the goals are to "create a memorable story" and "have a good time." Notice how those are not in-game goals, but actually metagame goals? The goal of the actual game is to "complete an adventure successfully," which can succeed or fail just like any game. "Having a good time" is not part of the actual game itself. It exists in the metagame.
So, D&D is already a very "meta" game. There are two levels to it. A lot of conflict among TRPG players comes from reconciling these two levels. When someone tries to "win" the adventure at the expense of the metagame, it conflicts with the meta-goals of the other players. We actually have a term for that in TRPGs:
Powergamer: noun. A TRPG player who focuses on "winning" the scenario (e.g., surviving the dungeon, killing the monsters, defeating the villain), rather than on participating in the metagame (e.g., portraying a memorable character, contributing to a believable and enjoyable story, making sure everyone has a good time).
When we talk about metagming in TRPGs, we're talking about an extreme form of powergaming.
Metagame (TRPG): verb. To use metagame knowledge to attempt to "win" the adventure (i.e., powergame) more effectively.
Example 1: The DM is running a Ravenloft game, so I'll make a Ranger with Favored Enemy: Undead.
Example 2: I've read the Monster Manual, so I know that this monster has a particular weakness (even though my character wouldn't necessarily know that). I exploit that weakness, so that I can more effectively kill this monster / survive the battle.
This activity is within the rules of the game, but is arguably "meta-cheating," as it contradicts the goals of the metagame.
Of course, the best D&D players know how to use the metagame to everyone's benefit, but I wouldn't call it "metagaming."
Example: I vaguely want to play a charismatic Wizard, but Carol rolled a high charisma, and wants to play a Wizard much more than I do. Our experience will be more fun overall if I play something else and let her have that niche.