The literal meaning of the North-American word haywire is wire for binding bales of hay, straw, etc. The earliest instance in the Oxford English Dictionary (2nd edition – 1989) dates from 1917, but I have found one in The Ostrich as a Cavalry Horse, a curious article published in The Chicago Daily Tribune (Chicago, Illinois) on 29th July 1879; among the many reasons for substituting the ostrich for the horse, according to the author, is this one:
His [= the ostrich’s] appetite is regular and never captious. Anything that he can get into his maw is good enough for him, and he eats with the relish of a 14-year-old boy. The ordinary refuse of the camp, such as pork and beef barrels, soap-boxes, old nails, hay wire, empty tin-cans, bits of rope, cartridges, and worn-out blankets, would furnish him with ample subsistence on a campaign, as any one of these articles of food goes a great ways [sic] with an ostrich.
The wire used in baling hay was often utilised for makeshift repairs. For instance, The Evening Times (Washington, D.C.) of 5th March 1900 published an article about the career of Henry Hart, “the magnate of the Third Avenue Railroad Company”, which contains the following:
He would drive down from his home on Madison Avenue in a rickety old coach drawn by old grey car horses—veterans of the car line. At first the old coach was drawn by a single horse, but in later years two were rigged to the odd vehicle. It seemed for years as if this old coach would fall to pieces on the street. It was mended with hay wire, was scratched and battered so that even an old nighthawk cabman would hesitate before looking for people to ride in such a vehicle.
From this practice of using hay-baling wire for temporary repairs, haywire came to mean crudely contrived, improvised, poorly equipped, inefficient. The following from The Virginia Enterprise (Virginia, Minnesota) of 22nd January 1909 seems to be an early instance of this figurative use:
Perhaps the necessity of an opera house was never more forcibly brought to the minds of Virginians than on Saturday evening when, after the “fall” of the new asbestos curtain at the Fay Opera at a critical stage in the production of Monte Cristo the murmur of “hay-wire” issued from behind the scenes and led Frederic Clarke to appear before the footlights after the removal of the debris with the statement that Virginia was evidently a thriving little city but that there was one thing sadly lacking—an opera house.
This figurative use was primarily found in the phrase haywire outfit, first recorded in Terms used in Forestry and Logging (Washington, D.C. – 1905), a bulletin of the U.S. Department of Agriculture, Bureau of Forestry:
Hay wire outfit. A contemptuous term for loggers with poor logging equipment. (Northern Forest)
The earliest actual use of haywire outfit that I have found is from The Bessemer Herald (Bessemer, Michigan) of 5th October 1912:
Some few months ago we were solemnly informed by the officials of the Michigan Telephone company that the antiquated, hay wire outfit in use here would be replaced by a modern exchange as soon as possible.
Therefore, especially in the phrase to go haywire, the word came to mean, of an object, tangled, out of order, of a situation, disorganised, confused, out of control, of a person, erratic, crazy. The earliest instance of this phrase that I have found is from a humorous article about Friday the 13th, published in the Warren Evening Times (Warren, Pennsylvania) on Friday 13th September 1918; according to the journalist, while the article was being written in the morning:
A piece of copy sent to the composing room went astray and the editor was mystified over inability to make the big clock in the editorial department move at [sic] it should. The ribbon on the typewriter of the associate editor went haywire which was productive of a little cussing and only one apple remained in the supply bag and it was half bad.
The second-earliest occurrence of the phrase is in this advertisement from the St. Helens Mist (St. Helens, Oregon) of 21st March 1919:
YOU WILL GET
Expert Repair Work
ON YOUR CAR AT THE
ST. HELENS GARAGE
If your car goes “HAYWIRE” on the road phone the
St. Helens Garage for their service car to help you.
OILS GASOLINE ACCESSORIES
ST. HELENS GARAGE
Phone 57 H. M. TERRY St. Helens, Ore.