In Dungeons & Dragons a swarm is a monster that's not a single individual, but a collection of much smaller creatures which are of (at best) animal level intelligence. A swarm may or may not fly, though ground-bound swarms exhibit excellent climbing ability, so high ground won't save you. Despite their large numbers, a swarm has a single statistic block, including one hit point total. Classic types of swarms are large masses of rats, spiders, bees, and Egyptian scarab beetles.
Swarms are notorious for their host of immunities and special abilities. Since killing a few rats in a swarm of hundreds isn't very useful, weapon attacks do half or zero damage (depending on the type of swarm). A swarm is immune to spells that target a specific number (including one and touch attack based spells) of creatures. Energy attacks do their normal damage, and area of effect damage abilities actually do 1.5 times as much damage. They don't target armor class, doing damage simply by being in your square.
While many swarms have a low Challenge Rating, they are notorious for being very deadly to low level parties, who have very few reliable means of damaging a swarm. Area of effect spells are rare and don't do that much damage anyways, and splash weapons are prohibitively expensive. Energy damage is virtually impossible outside of your precious few spells, many of which don't even work on swarms since they are single-target based. There are only two weapons cheap enough for low level parties to field against swarms: Torches and lantern oil.
Torches are improvised weapons that deal some fire damage on top of minor bludgeoning, but the rules aren't even consistent on how much fire damage (torches themselves say 1, swarms say 1d3). Since torches are an improvised weapon you take a -4 penalty to hit if using one. Good luck hitting an effective 18 AC at level 2 (and you need to do it ~6 times)! Lantern oil is a bit better, dealing 1d6 damage and then 1d6 damage the next round (both multiplied by 1.5, so two successful ones might kill a rat swarm), but it takes a full round to prepare (rules are mum on if you can keep them prepared for throwing long term) and only works half the time!
Alongside the housecat and incorporeal foes (e.g., ghosts) swarms are some of the deadliest monsters for their CR in the Monster Manual/bestiary. They kill a lot of unprepared adventurers and even some prepared ones. The Mummy's Mask Adventure Path includes an early summoned scarab swarm that, being a summoned creature, disappears in two rounds. Jim Groves, the author of this part, outright stated this was to warn players that there were swarms in the adventure and to prepare accordingly. Yes, he felt the PCs needed to be warned about a generic nameless enemy type before any of the threats that were important to the story. And he was right. The video game Pathfinder: Kingmaker (the only D&D rules based video game to actually feature swarm monsters) featured a cave with spider swarms early on, it was possible to make this your third fight after the prologue sequence, and this prompted much butthurt. In response the developers made it optional and gave further warning/explanation in the Enhanced Edition.
Interestingly, since undead creation is based on hit die instead of creatures targeted, swarms can be made into Undead. Insects in particular can become exoskeleton creatures difficult to distinguish from normal instances. Thankfully this doesn't increase their lethality and even drops it slightly: Turn Undead (and Channel Positive Energy in Pathfinder) actually work against them, as does holy water (though it's still expensive).
"What if we made swarms, but of human sized enemies?" was the natural evolution of swarms, and there's at least 3 different variants in d20 based games and none of them are that good.
3.5's Dungeon Master's Guide 2 introduces Mobs. Mobs are supposed to be spontaneous groups with no leader, like an angry mob or stampede of animals, but while officially a template that alters a creature a mob is effectively a single CR 8 creature that gets a few changes from the base creature.
Star Wars D20 Saga Edition introduces Squads in The Clone Wars Campaign Guide as a +2 Challenge Level template. Unlike other examples, squads are a relatively small number of foes, generally 3/4, but share many similarities. Squads are bigger, harder to injure, have double the HP, get +4 to attack (as they are considered to be aiding another), make all attacks (except Attacks of Opportunity) as selective area effects and can't be grappled. On the weakness side they take extra damage from area attacks, which are everywhere in Saga Edition, and don't get any bonuses to autofire themselves, even though autofire is an expendable foe's best chance of hurting a PC that outclasses them. Also they can't walk through narrow spaces even though they're still just a bunch of medium creatures who should be able to walk in sequence. Interestingly the template doesn't restrict what it can be used on, so you can technically apply it to spacecraft and vehicles... where it actually works quite well since autofire is rarer in space and narrow obstacles are rarely extant.
Pathfinder introduced troops. Unlike the rest, troops aren't a template but a type of creature. Troops don't quite work since all their attacks are automatic or (for ranged attacks) reflex save based, meaning AC is useless, and they don't really play nice with allies since they can't really be buffed. As of the end of the system's official support there were a mere dozen troops, most of which were only published Adventure Paths.