The OED Online, in an entry "not yet fully updated (first published 1899)", gives this etymology for 'hoodlum':
The name originated in San Francisco about 1870–2, and began to excite attention elsewhere in the U.S. about 1877, by which time its origin was lost, and many fictitious stories, concocted to account for it, were current in the newspapers. See a selection of these in Manchester (New Hampshire) N. & Q. Sept. 1883.
The Online Etymology Dictionary has this to say on the subject:
popularized 1871, American English, (identified throughout the 1870s as "a California word") "young street rowdy, loafer," especially one involved in violence against Chinese immigrants, "young criminal, gangster;" it appears to have been in use locally from a slightly earlier date and may have begun as a specific name of a gang:
"The police have recently been investigating the proceedings of a gang of thieving boys who denominate themselves and are known to the world as the Hoodlum Gang." [San Francisco "Golden Era" newspaper, Feb. 16, 1868, p.4]
Of unknown origin, though newspapers of the day printed myriad fanciful stories concocted to account for it. A guess perhaps better than average is that it is from German dialectal (Bavarian) Huddellump "ragamuffin" [Barnhart].
"What the derivation of the word "hoodlum" is we could never satisfactorily ascertain, though several derivations have been proposed; and it would appear that the word has not been very many years in use. But, however obscure the word may be, there is nothing mysterious about the thing; ...." [Walter M. Fisher, "The Californians," London, 1876]
Can we do better than OED Online or Online Etymology Dictionary?
The most expert analysis of the origin I've so far discovered is this from "Hoodlums and Folk Etymology", Peter Tamony, Western Folklore, Vol. 28, No. 1 (Jan., 1969), pp. 44-48: