How did "s***" and "the s***" come to mean opposite things?
Your idea is shit
Your idea is bad.
Your idea is the shit
Your idea is good.
The same does not apply to "the crap" or "the poop", or other profanity like "the fuck".
I can think of examples where adding "the" to a noun makes it descriptive, like "the sux0rs" (bad), "the man" (good). I can't think of another example where a bad word is made good by adding "the".
It looks like it is originated as a slang term for drugs, then gained a broader usage in time. Below is an excerpt from The Routledge Dictionary of Modern American Slang and Unconventional English edited by Tom Dalzell:
And here is the earliest usage of the shit as a drug in 1967 from the book How to Talk Dirty and Influence People By Lenny Bruce:
(the earliest usage I could find)
There is an Urbandictionary entry related:
The best. Originated as a term to describe high quality drug substances. IE, "this is good shit."
Evolved to common usage for any item of high quality. However, in typical usage, the article "the" is required to denote superiority. Without the word "the" prefacing the word "shit," a different, usually negative, meaning applies.
There is also the shiznit but even shiznit is used instead of the shit.
shiznit: More "urbanized" form of the shit. Basically means really, really good. Other versions include:hella cool,tight, the best. [Urbandictionary]
the shiznit: 1.something really cool.2.used to express joy in something/someone.3.to express that something is really or very good. [Urbandictionary]
There is also a less common term, the junk.
The epitomy of being sick, dope, or tight. [Urbandictionary]
Note: One needs to be careful though, because the shits means diarrhea.