A close-up of Black Hat from Kill Hitler
As referenced in comic #29, Black Hat character and headgear was originally a reference a character named Aram from a now-defunct webcomic entitled Men in Hats - http://www.meninhats.com/. Like Black Hat, Aram seems to have frequently made judgmental, insulting or controversial comments in a very emotionless manner. Aram wore a grey (perhaps intended to be black) suit with a red bowtie and a black top hat with white strip above the brim. In his earliest appearances, Black Hat wore a taller top-hat style hat. This quickly evolved into the boater style hat he currently sports over the next several appearances. Comic #29 references Black Hat as "the hat guy".
Black Hat does not appear to have originally been a reference to Black hat hacking. However, the character has evolved to have very similar motivation, hatching evil schemes often for no reason other than to cause chaos or go against the societal norms.