The nickname Bluey originated in the 1890s and was used as a nickname throughout World War One to refer to red-haired soldiers of the Australian Imperial Force, especially from New South Wales. During the Second World War, nearly every redhead was nicknamed Bluey, and it spread to civilian life.
The name is ironic, and it seems red-haired men didn't mind it, compared to the usual ginger or red nicknames that are often derogatory.
(I've not confirmed it, but it's been said it may have come from blue meaning fight, based on the belief red-haired Irishmen were prone to fighting, and the phrase, "There goes a blue", when an potential fight walks past.)
The Barrier Miner (Broken Hill, NSW), Saturday 30 March 1940:
It is hard to understand why New South Wales pals in the A.I.F. always named red-headed fellows "Bluey." That nickname of "Bluey" stack to copper headed diggers throughout the war, and it has been carried on in civilian life until this one.
In the Bendigo Advertiser (Vic), Saturday 23 November 1918, "'Nuggutt' in the London "Daily Express" writes about "Army Nicknames" and asks, without answer, "Why is a Red-Headed Man Called Bluey":
I have absolutely nothing to say against the unalterable military law that all Murphies in the army are "Spuds" and that all Clarkes must be "Nobbies". True, I don't know what "Nobbies" are, but I am satisfied that even young and tender Clarkes can qualify for the job. What I want to know is: Why do the Australians call a red-headed man "Bluey?"
Bluey! It seems so silly. Why Bluey? You see a red-headed Australian and you sing out, "Got, a match, Bluey?" and he smiles and gives you one. He doesn't knock you down; he smiles, and answers to the astonishing inexactitude with the cheerful alacrity of a dug-outful of kamerads responding, to a Mills grenade. It is very strange.
I have tried to follow ihis "Bluey" to its lair, but army nicknames have no certuinable parents. They are like Topsy, and they seem to accompany their owners, often their unhappy owners—as a sort of aura.
The Argus (Melbourne, Vic.), Saturday 6 January 1940 says it wasn't an insulting nickname:
Strange, but while with his copper-coloured hair he responds cheerfully to the nickname of "Bluey," call him "Red" and he sees that colour vividly.
But the nickname goes back further, and can be found in the Australian Town and Country Journal (NSW), Saturday 22 October 1898, writing about "The Sydney Newsboys' Day Out":
Quite a number made a little god of Mr. "Johnny" Coleman, who was entertained with songs by lads of the high-toned nicknames of "Jinks," "Chops," "Nipper," "Big Tommy, "Bluey," &c., each of whom he rewarded with a silver coin.
The Concise New Partridge Dictionary of Slang and Unconventional English (2008) by Eric Partridge, Tom Dalzell and Terry Victor says:
Bluey noun used as a nickname for a red-haired person. Ironic in origin. Australia, 1906
A Dictionary of Slang and Unconventional English (2002) by Eric Partridge and Paul Beale defines it:
5. A nickname for a red-headed man: from ca. 1890, esp. in Aus. and NZ.
Richard Branson says in his 2012 autobiography, Like A Virgin: Secrets They Won’t Teach You at Business School:
In the 1850s, a large influx of immigrants arrived in Australia, hoping to make their fortunes in the gold fields. The Irish, many of whom were redheads, soon gained a reputation as hard drinkers and fighters. A fight, in local slang, was a 'blue'. When a redheaded Irishman passed by, people would say, 'There goes a blue', and to this day, Australians often give their redheaded friends the nickname 'Bluey' while 'blue' is the general equivalent to 'pal', 'mate' or 'buddy'.
In 2000, when we were preparing to launch the airline in Australia, an Australian chef on Necker said to me 'Why not call it Virgin Blue?'. He suggested that Aussies would connect our upstart nature and the traditional red logo with the name Virgin Blue. To highlight the play on words, we painted the planes a bold red.
I can't find any other instance of "There goes a blue" in Google Books, nor in the Trove archive of Australian newspapers (1803 - 1994) or in any dictionaries.
The Concise New Partridge Dictionary of Slang and Unconventional English (2008) has the verb blue meaning to fight as Australian but only since 1962. The OED has the verb as Australian and New Zealand slang from 1955 (the quotations use blueing and blued), and a noun blue as Australian and New Zealand slang (an argument, quarrel, fight, brawl) from 1944 which they suggest may be from to turn the air blue, meaning to swear.