The word was originally coined by Murray Gell-Mann as a nonsense word rhyming with "pork"[1], but without a spelling. Later, he found the word "quark" in James Joyce's book Finnegans Wake, and used the spelling but not the pronunciation:
Three quarks for Muster Mark!
Sure he has not got much of a bark
And sure any he has it's all beside the mark.
In this context, the word rhymes with "mark", and "bark", but the physics term is pronounced "kwork". Gell-Mann's own explanation:[2][3]
In 1963, when I assigned the name "quark" to the fundamental constituents of the nucleon, I had the sound first, without the spelling, which could have been "kwork". Then, in one of my occasional perusals of Finnegans Wake, by James Joyce, I came across the word "quark" in the phrase "Three quarks for Muster Mark". Since "quark" (meaning, for one thing, the cry of the gull) was clearly intended to rhyme with "Mark," as well as "bark" and other such words, I had to find an excuse to pronounce it as "kwork". But the book represents the dream of a publican named Humphrey Chimpden Earwicker. Words in the text are typically drawn from several sources at once, like the "portmanteau" words in "Through the Looking Glass". From time to time, phrases occur in the book that are partially determined by calls for drinks at the bar. I argued, therefore, that perhaps one of the multiple sources of the cry "Three quarks for Muster Mark" might be "Three quarts for Mister Mark," in which case the pronunciation "kwork" would not be totally unjustified. In any case, the number three fitted perfectly the way quarks occur in nature.
The phrase "three quarks" is a particularly good fit (as mentioned in the above quote), as at the time, there were only three known quarks, and since quarks appear in groups of three in baryons.
In Joyce's use, it is seabirds giving "three quarks", akin to three cheers, "quark" having a meaning of the cry of a gull (probably onomatopoeia, like "quack" for ducks). The word is also a pun on the relationship between Munster and its provincial capital, Cork.