The story
Unknown. Attested from 1902, originally meaning “in a bad way” or “in bad condition”, malfunctioning of an appliance. Perhaps from German name Fritz, or onomatopoeic (imitating the sound of electric sparks jumping).
Etymology from Wiktionary, CC BY-SA 4.0.