The OED establishes that the original name of the food was "Welsh rabbit", and mentions "Welsh rarebit" only as an "etymologizing alteration of [the preceding]. There is no evidence of the independent use of rarebit". The source is not exactly known, but most likely was originally a slur. In the 17th and 18th centuries it was common to use the adjective "Welsh" to mean inferior quality, even implying counterfeiting. In a society where most people could snare a rabbit for the cooking pot, a Welshman was considered by some people so hopelessly feckless that cheese melted with beer would have to substitute.
Vivid nightmares are famously attributed to overindulgence in Welsh rabbit. This is probably due to the gastrointestinal irritation many experience after consuming a large amount of dairy products.
This phenomenon is immortalized in Dreams of a Rarebit Fiend, a series of comic strips written and drawn by Little Nemo creator Winsor McCay beginning in 1904. Each strip portrayed a nightmare experienced by a protagonist, a rarebit fiend who had made the poor choice of consuming too much rarebit before bedtime. There was also an episode of Gomer Pyle, U.S.M.C. in which the Welsh Rabbit that Gomer consumes causes him to sleepwalk and verbally attack Sergeant Carter.