A frantically swimming fish is likely experiencing significant stress. Other stress symptoms include hitting the bottom of the tank, locking its fins to its side, and rubbing itself on gravel or rocks.
Sources of stress for aquarium fish vary, and veterinary advice may be needed to alleviate it. Possible causes are problems with water conditions, such as low oxygen, improper temperature, pH imbalances, or high ammonia or nitrate levels. If the stressed fish is not the only one in the aquarium, there may be too many fish in the aquarium or excessively aggressive fish. Other chemicals in the tank, improper diet and habitat disturbances (for example, a child banging on the aquarium glass) also could be culprits.