Metamagic is a game mechanic created in Dungeons & Dragons 3rd Edition. As the name implies, it is a way for spellcasting classes (wizards, sorcerers, clerics, druids, etc.) to get even more powerful by tinkering with certain aspects of their spells, augmenting them in various ways, such as removing the need for certain components, expanding their area of effect, and so forth.
While it was truly introduce in 3rd edition, it has its roots in a number of older spells from still older versions of the game. Notably, spells like sequencer and contingency, only some of which survived metamagic, gave casters the ability to play with their spells and fiddle with their output.
In 3rd edition, metamagic was handled as a family of feats that casters could pick up. Each metamagic feat represented a specific magical trick that a caster could apply when preparing or casting a spell, depending on their casting style, and usually with some drawback - mostly in the form of requiring a higher spell-slot than before. Multiple metamagic effects could be stacked on the same spell, but this could get prohibitively expensive in terms of spell slots. You could throw a massive fireball with a huge area of effect that not only maximized the damage instead of rolling for it but also increased it by 1.5 times, but it would require the same spell slot to prepare as a wish spell.
Notably, the famous Quicken Spell metamagic allowed character to break action economy, throwing spells around as one action less than their normal casting time, making it powerful and infamous despite the staggering four spell level hike. Also, divine casters had access to Sacred Spell, to let them penetrate any kind of resistance because fuck you, as a component of their infamously powerful status.
Some metamagic feats could be taken multiple times. Most prominently, the Energy Substitution metamagic feat, which was broken up into five subfeats; Acid, Cold, Electric, Fire and Sonic. Each version of Energy Substitution taken allowed the caster to replace the normal energy type of their spell with that feat's type; Energy Substitution (Acid) could be used to create a Chain Lightning spell that did acid damage, whilst Energy Substitution (Cold) could be used to create Fireball spell that did cold damage.
Notably, it was much harder to use for spontaneous caster compared to prepared ones for... reasons. Reasons that may have started with a mixture of sloppy editing and unreasoning paranoid about the power of spontaneous casting vs. the traditional kind and turned into spiteful malice and an editor/author trying to win a long-lost forum argument in the transition from 3rd edition to 3.5 with the ultimate rules-beating stick. For example, while a wizard who wished to cast a reach shivering touch spell for maximum cheese had only to have the Reach Spell feat and access to the fifth level slot necessary and prepare it thus, a sorcerer who wished to do the same must not only have the slot and the feat, but spend a full round action to make it go off. This also meant that Quicken Spell was useless to a spontaneous caster.
Happily, limited salvation was to be found in the form of Rods of Metamagic! These not-at-all-phallic-and-why-would-you-think-that magic items were each attuned to specific metamagic feats, and could apply metamagic to spells for free a limited number of times per day, requiring neither a spell-level hike nor, in the case of spontaneous casters, a full-round action. Said rods typically came in three flavors of potency, with lesser rods only working on the weakest spells and only greater rods helping out with the big boys.
Metamagic vanished in 4th edition, because it just didn't quite work with the new paradigm to how spells worked. Its spirit lived on in the form of various feats that provided permanent innate augmentations to different spells in a broad sense.
Pathfinder kept most of the 3rd edition metamagics, adding in a few of its own. Energy Substitution was now a feature of specific classes, though. One trait (a form of "half-feat" the game introduced), called Magical Lineage, let a character pick one spell and reduce its effective level by one while applying metamagic to it. Also introduced were Selective Spell, which allowed people throwing AoE's around to exclude their party members, and Intensify Spell, which doubled the level cap for spells that rolled extra dice for caster level. The latter in particular is much beloved by the whole magus class that needs shocking grasp and/or snowball to function on par with others in their intended role.
While the problems spontaneous casters have with metamagic were fully intact, a number of cheesy tricks and character options helped mitigate it, such as the Arcane sorcerer bloodline.
It returned in 5th edition, now relegated to a class feature for the Sorcerer, which could burn "sorcery points", a pseudo-mana system, when casting a spell in order to activate metamagic effects; sorcerers can now choose which metamagics they learn as they level up. Unfortunately, due to various issues...namely, how few sorcery points they get, the fact sorcery points are also used to replenish depleted spell slots, and the fact that sorcery points only recharge on a long rest... well, it makes metamagic a lot less useful in 5e than it was, which has upset many sorcerer fans. They also don't get nearly enough choices nearly often enough.
Also, while certain combinations are still very potent (Twinned Spell + haste = best combat buffer in the game for levels to come), and collapsing Still Spell and Subtle Spell into one power that also goes off very cheaply is very, very nice, Quicken Spell, though still good, is hurt by the game's mechanics. Since there's a hard cap of one spell and one cantrip per round, no more, it's a good but not abuseable trick. This is good in a vacuum, but a bit of a pain for a class that could really stand a few more abuseable tricks to its name.
It's telling that the Lore Master Arcane Tradition for wizards in Unearthed Arcana didn't once mention the word "metamagic", and yet it still manages to blow sorcerers out of the water in terms of being able to tweak and modify spells on the fly for greater efficiency in battle; its very first feature, Spell Secrets, lets it change elemental damage typing for its spells at will - which is considered broken in and of itself, because that's a category that includes Force damage, which practically no enemy resists - and also change the saving throw required of 1 spell per encounter, which means they can spontaneously tailor a spell to strike a particular weakness of a creature that would normally be heavily resistant to it due to having a good saving throw. Then, at level 6, its Alchemical Casting lets it modify certain spells by burning an extra spell slot; give up a 1st level spell slot when casting a spell that inflicts damage for +2d6 bonus Force damage, give up a 2nd level spell slot when casting a ranged spell of at least 30 feet to instead upgrade its range to 1 mile, and give up a 3rd level spell slot when casting a spell with a saving throw to increase its DC by +2. Level 10's Prodigious Memory feature lets a Lore Master use a bonus action to swap one of its memorized spells out for a prepared spell instead once per encounter, which would be toe-stepping harder if sorcerers weren't already sucking so hard in terms of spell output per day and actual versatility. Things come to a cap with its ultimate subclass feature: level 14's Master of Magic, where, 1/day, the Lore Master can choose to cast a single spell from any other class's spell list. Which, admittedly, would be more impressive if the spell-lists didn't boil down to "Wizard, Cleric, and token tweaks to either of the aforementioned".
Fans of the sorcerer were outraged, prompting such a backlash that the School of Invention, what many believe to be the 2nd iteration of the Lore Master, was portrayed as a Wild Mage/Artificer hybrid with a theme of "bumbling gnomish know-it-all". Even so, the whole fact that the Lore Master's old design used to be stupidly powerful was subtly mocked by fluff for them implying that they're not nearly the clever magic masters that they think they are.