"He's talking through his hat."
To "talk through your hat" is an English idiom meaning to talk about something that you have no real knowledge of. It may also mean that you are talking nonsense, or that you are deliberately lying.
Dis is only a bluff dey're makin' – see! Dey're talkin' tru deir hats.
--New York World 13, May 12, 1888
The OED reports that the first written appearance of the phrase appeared in 1888. It was most likely in use before this, but Victorian-era America was sadly lacking in ethnographers. We have no good idea how it may have originated. It may be related to the British English phrase "talk through the back of your neck", which has essentially the same meaning. Unfortunately, we don't know where the British phrase originated (nor the related phrase "talk through the back of your head"). Even worse, the OED reports that 'back of your neck' didn't make it into print until 11 years after 'though your hat' (this could be due to a comparative lack of yellow journalism in England during this time period; America pioneered the use of street slang in the papers).
It is worth mentioning that in the 1860s the idiom "wearing two hats" first came into use, meaning 'acting in two roles' (e.g. "The president of the US wears two hats, that of the chief executive of the federal government and Commander in Chief of the armed forces"). If it were the case that it was common for professionals to be referred to as as their 'hats', one might explain confusing, jargon-filled utterances by saying "he was talking though his [doctors] hat". This is pure speculation on my part, as it seems that it was primarily members of the Catholic church who were referred to as hats (e.g. "The red hat that tries the luckless main"). However, it would be a small jump from "He's talking gibberish 'cus he's a doctor/lawyer/cardinal" to "He's talking gibberish".
These days most of use are more likely to use the cruder phrase talk through your ass or talk through your arse.