The word "school" is used as a collective noun for fish because it refers to a group of fish swimming together.
The term "school" likely comes from the way that fish move in a coordinated manner, similar to the way students move together in a school.