To go wrong, to become overly excited or deranged.
Hay-wire is the light wire that was used in baling machines to tie up bales of hay. At the turn of the 20th century the expression 'a haywire outfit' began to be used in the USA. This was used to describe companies that patched-up faulty machinery using such wire, rather than making proper long-term fixes. In 1905, The US Forestry Bureau Bulletin described a 'Hay wire outfit' as 'a contemptuous term for loggers with poor logging equipment'.
By 1920, the use of haywire to mean 'awry' or 'out of control' was recorded in Dialect Notes, Volume 82:
"Hay wire. Gone wrong or no good. Slang."
This may be a reference back to 'hay-wire outfits' but is more likely to be a literal allusion to scrambled hay-wire - anyone who has handled coils of wire will be familiar with its determination to gather into an irretrievable tangle. To go haywire was recorded in the late 1920s; for example, in this piece about a basketball game from The Helena Independent, January 1928:
"...their anxiety to score let their passing game go haywire with many wild heaves finding marks in the bleachers."
See other phrases that were coined in the USA.