Mechanically, a swarm is a creature with a singular stat block like any other creature. The creature's type may be Beast, Plant, or whatever. A swarm has senses, a movement speed, resistances, immunities, vulnerabilities, traits, actions, and attacks. "Swarm" is just a trait the creature has...