This is because a thesaurus is a book that contains a collection of synonyms and related words, essentially a "treasure" of words for writers and speakers to use.
It's interesting to note that the word "thesaurus" was initially used in a broader sense to refer to any collection of valuable information, not just words.