The story
Uncertain; probably from one of two jokes, one in which a protracted search for an alleged remarkably shaggy, talking dog ends in the discovery of the dog which, though it can indeed talk, is disappointingly not so shaggy after all; or one in which an even more protracted search for the shaggiest dog in the world ends in the utterly anticlimactic punchline “Now that’s a shaggy dog!”.
Etymology from Wiktionary, CC BY-SA 4.0.