Knuth began TeX because he had become annoyed at the declining quality of the typesetting in volumes I--III of his monumental "Art of Computer Programming" (see Knuth, also bible). In a manifestation of the typical hackish urge to solve the problem at hand once and for all, he began to design his own typesetting language. He thought he would finish it on his sabbatical in 1978; he was wrong by only about 8 years. The language was finally frozen around 1985, but volume IV of "The Art of Computer Programming" has yet to appear as of mid-1993. The impact and influence of TeX's design has been such that nobody minds this very much. Many grand hackish projects have started as a bit of toolsmithing on the way to something else; Knuth's diversion was simply on a grander scale than most.
TeX has also been a noteworthy example of free, shared, but high-quality software. Knuth used to offer monetary awards to people who found and reported bugs in it; as the years wore on and the few remaining bugs were fixed (and new ones even harder to find), the bribe went up. Though well-written, TeX is so large (and so full of cutting edge technique) that it is said to have unearthed at least one bug in every Pascal system it has been compiled with.