A coincidence is an unexpected overlap of events. Serendipity involves discovering something worthwhile by chance. A coincidence does not have to be pleasant or useful.
Two classmates arriving in identical coats is a coincidence. Opening the wrong library book and finding a useful source for your project is serendipity. The useful discovery makes the difference. See the meaning of serendipity for more context.
Related question: Can “serendipity” describe something bad?
Reference: Cambridge Dictionary: Coincidence.
