Purple bag syndrome occurs when bacteria within the urine produce red and blue pigments. This adheres to the lining of the catheter bag, turning it a vibrant purple, even though the urine itself isn't discoloured.