Phosphates normally come from fish food, in particular dry fish flake and pellets.
Phosphates in tap water is from phosphate residue leaching into the drinking water. It comes from detergents and garden fertilisers.
You want as little phosphate as possible and the same applies to nitrate.
You might want to get a reverse osmosis unit to give you clean water or put some nitrate & phosphate removing granules in your filter.
Blue green algae can grow in water with or without phosphates or nitrates. It is more common in water with them and also in water with low oxygen levels and little water movement.
Rotting food in the tank will increase the BGA problems and cause the nitrates & phosphates to go up rapidly.