This word — meaning the ability to make unexpected and fortunate discoveries — has been around for more than two centuries, but only really began to be used much in the twentieth century, to the extent that the adjective serendipitous is not recorded before about a century ago:
I felt quite “serendipitous” the other day, as in toiling over the moor in search of a lead mine, I ran into a wonderful machine, in which 10,400 eggs were hatching into chickens — at different points in that 21 days process.
Yorkshire Evening Post, 9 Apr. 1923.
Horace Walpole coined it in a letter he wrote to his long-time diplomat friend Horace Mann in 1754. He told him that he invented it in reference to the title of an old Persian fairy story The Three Princes of Serendip, whose heroes regularly discovered pleasant things that they weren’t searching for.
If you read the story you will find that the princes were well educated and intelligent men and their good fortune (which was a bit slap-dash: they got thrown in jail as suspected camel thieves at one point) was based on careful deduction and sagacity, not chance. As the saying has it, “fortune favours the prepared mind”, just as discoveries today that are said to be serendipitous are so often the result of experience and good observation.
The three princes came from a country the Persians called Sarandib but which we now know as Sri Lanka, or in earlier times Ceylon. The Persian is a corruption of the Sanskrit Sinhaladvipa, “the island where lions dwell”, hence the name Sinhala or Sinhalese for the most commonly spoken Sri Lankan language.