The word “serendipity” was coined in 1754 by the politician and writer Horace Walpole, who used it in a letter in which he recounted an accidental but fortunate discovery about an acquaintance:
This discovery indeed is almost of that kind which I call serendipity, a very expressive word which, as I have nothing better to tell you, I shall endeavour to explain to you: you will understand it better by the derivation than by the definition. I once read a silly fairy tale, called “The Three Princes of Serendip”: as their highnesses travelled, they were always making discoveries, by accidents and sagacity, of things which they were not in quest of.
A Wiktionary definition is available here while a Wikipedia definition is available here.