Terrible and terrific are both formed off the same root: terror. Both started out a few hundred years ago with the meaning of terror-inducing. But terrific took a strange turn at the beginning of the 20th century and ended up meaning really great, not terrible or terror-inducing at all.
This happened through a slow reshaping of the connections and connotations of terrific. First it acquired the sense, not just of terror-inducing but of general intensity. You could talk about a "terrific clamor," meaning a whole lot of clamor. This was a bit of hyperbole — "so much noise it was terror-inducing!" — that eventually got reduced to a general sense of "more intense than usual." Once a word like that gets established as a general intensifier, it may also be applied to positive experiences — terrific beauty, terrific joy — and from there the jump to a fully positive "terrific!" isn't so unexpected. The same thing happened to the word tremendous ("causing one to tremble in fear"). It happened to formidable (fear-inducing) too, but only in French, where it means "really great!" It hasn't quite reached that stage in English, but it has acquired positive intensifier status ("a formidable talent").
The path from fear to happy enthusiasm isn't an inevitable one. Awful also started as a fear word — "awe" used to have much stronger connotations of quaking with fear before powerful forces — and came to be a general intensifier ("that pie was awful good!"), but it hasn't crossed over to the happy side. On the other hand, its close relative, "awesome," did make the jump.
The fully positive "awesome," a child of the '80s, is a relatively recent innovation. It began as slang, with a dash of irony or sarcasm to it. That seems to be the crucial ingredient in these crossover words. The positive "terrific" dates to the slang-heavy flapper era, where "killer" also became a playful positive. "Egregious," a word that made the opposite crossing from positive to negative (it used to mean notable, excellent), also appears to have arisen from an ironic use. And we have plenty of very recent examples of slang crossover (Sick! Ill! Wicked! Bad!).
Crossover words are a tremendous testament to our awesome ability to shape the language as we use it. To master our fears. To take our terror and use it to build something terrific.