The song is about the peculiar habits of the English, particularly their tendency to engage in outdoor activities during the hottest months of the year, when most people would prefer to stay indoors.
The lyrics themselves provide the answer to the question:
> **"In the heat of the day, you know, when the sun is blazing
> Mad dogs and Englishmen go out in the midday sun"**
Therefore, the phrase itself originated from Noel Coward's song. It has since become a common idiom used to describe people who engage in unusual or uncomfortable activities, especially in extreme weather conditions.