The phrase “wild hair” (as in ‘he took off from work because he had a wild hair’) is short for “wild hair up his butt.” It means to have a fixation or obsession with something, because if you have a wild hair up your butt you can’t think about anything else.

The Washington Monthly (source)

Not to be confused with