The common name for a group of fish swimming together is a school. In biological usage, schooling describes fish that move in a coordinated way, generally traveling at similar speeds and in the same direction.
The broader term is shoal. A shoal is any social grouping of fish, even when individuals are loosely arranged or moving independently. A tightly coordinated shoal becomes a school, although everyday speech often treats the two words as synonyms.
Schooling can improve protection from predators because many fish can watch for danger and the odds of any one individual being attacked are reduced. A large group may also make it harder for a predator to track a single target. Fish may gain feeding and swimming advantages as well, and some species gather in schools during migration or spawning.
About one-quarter of fish species shoal throughout their lives, while roughly half shoal during part of their lives. Famous schooling fish include herring, sardines, anchovies, and many reef fish.