Anything that can decay (organic) will release ammonia in water, which is toxic at high levels, at low levels fish wont even survive. Algae consumes ammonia and thrives, eventually ammonia turns into nitrates, which are then turned into phosphates depending on how many living organisms are in the water. Hope it helps your understanding a bit :P

Is it possible that dead worms in a pool will cause ammonia to go up? Of course, and it may be the number one reason. As for a solution: Drain it half way, add a gallon or two of shock once it is full and filtering, then see if you get a chlorine reading, add more shock until you do. You may need to drain and fill repeatedly to get a reading. It may also help to know the PH, and Cyanuric Acid levels and test procedures you use.