To elaborate on what JChillin said, in the wild, fish school for two main reasons: predator protection and cooperative hunting.
Also, there are different types of schools, depending on the species. In polarized schools, all the fish swim together in the same direction, same speed, etc. (my...