It can seem weird to think about words being invented. When a new species of bird or a new planet is discovered, we immediately understand that that bird or planet will need to be named. If someone invents a new machine never before seen on Earth, of course she or he will need to invent a name for that machine. But how do other sorts of words get invented?
First of all, we usually say a new word is coined, not invented.
Second, often creative and imaginative authors coin new words. That is what happened with the word serendipity. An art historian and writer named Horace Walpole was writing a letter to another man named Horace (Horace Mann), and he needed a word for a discovery made through a happy accident. He remembered what he thought of as a silly fairy tale, "The Three Princes of Serendip," in which some princes discover the nature of a lost camel mostly through lucky accidents. (By the way, Serendip is the Persian name for Sri Lanka.) Referencing that 1557 fairy tale, Walpole referred to a lucky accident as a serendipity.
|This is called Serendipity Cave.|
Other coiners of words...
Shakespeare is famous for having coined words and phrases, although it may be that some of the words attributed to him were in use but had not yet been written. Words such as eyeball, honey-tongued, gloomy, and fanged are just a few of the many, many words that first appeared in print in a Shakespeare play or sonnet. If you want to check out an entire list of Shakespeare's coinages, go here. http://www.pathguy.com/shakeswo.htm
Lewis Carroll (yesterday's birthday boy) also invented words. He didn't necessarily take words that already existed and put them together (as Shakespeare did with eye + ball), nor did he necessarily reference stories (as Walpole did with serendipity). He just flat-out invented nonsense words. Yet some of his nonsense words have been picked up and are these days used as real words: chortle, galumph, burble.
People are still coining words. Stephen Colbert of The Colbert Report, along with his writers, invented the word truthiness, which means a so-called "truth" that a person "knows from the gut" or from emotional appeal--but which has no relation to evidence or logic. With new technology terms like app and tweet have been coined, and some bad economic times have spurred the development of words like sub-prime and bailout.
For more on new words, check out this earlier post.