Like humans, fish exhibit this behavior for the same reason. That is, they are trying to relieve themselves of irritation and remove foreign objects from their skin.