Both dictionaries and lexicons are collections of words. Both words derive from Latin and Greek words meaning “to speak” or “to say.”
dictionary: A book dealing with the individual words of a language (or certain specified classes of them), so as to set forth their orthography, pronunciation, signification, and use, their synonyms, derivation, and history, or at least some of these facts
lexicon: A word-book or dictionary; chiefly applied to a dictionary of Greek, Hebrew, Syriac, or Arabic.
The word dictionary entered English before lexicon. Thomas Elyot first used the word in the title of his Latin-English dictionary in 1538. Earlier English writers all the way back to Old English times compiled collections of words, but under different labels.
Dictionaries are of two kinds. One kind pairs words in two languages. This was the first kind. The oldest known are Sumerian-Akkadian word lists on cuneiform tablets. In England, the Anglo-Saxon scholar Aelfric (c. 955-1012) compiled a Latin-English vocabulary grouped under topics such as plants and animals. The first English-English dictionary in alphabetical order was compiled in 1604 by Robert Cawdrey, an English school teacher. In 1755 Samuel Johnson completed A Dictionary of the English Language. His was the most extensive and reliable English dictionary until the achievement of the Oxford English Dictionary in the 19th century.
Although originally applied to dictionaries of Greek, Hebrew, Syriac, or Arabic, the word lexicon is now used in the sense of “vocabulary proper to some sphere of activity” or simply as an elegant variation on the word dictionary. Lexicon is the word of choice when it comes to collections of words related to supernatural matters, for example: The Harry Potter Lexicon, and The Twilight Lexicon.
Words related to lexicon are
lexicographer: A writer or compiler of a dictionary.
lexical: pertaining to words
lexeme: A word-like grammatical form intermediate between morpheme and utterance, often identical with a word occurrence; a word in the most abstract sense, as a meaningful form without an assigned grammatical role; an item of vocabulary.
lexis: the total word-stock of a language; diction or wording as opposed to other elements of verbal expression such as grammar.