Are you using powdered "shock"? I used to use that before switching to the methods recommended on this site. Sometimes, the product would gather together like that on the surface of the water. I don't know the scientific reason for it!
But have you tested your water? My guess is that it is out of balance, causing the flocking effect.