The story
Likely a clipping of get something twisted out of shape, referring to a notion or idea that has been taken out of proper context. Also likely from the observation that twisted wires or lines often result in miscommunication and error.
Etymology from Wiktionary, CC BY-SA 4.0.