Good question. Trying to think of some. Penicillin I suppose, potassium bromide for epilepsy (they thought it was caused by excess wanking, but the potassium bromide does actually have anti seizure activity.) I think benzos were found by accident looking for antibacterial drugs, spilling something and noticing that the mice or staff or whatever really chilled right out.
This is why they do stuff now like screening against whole libraries of molecules - Tim Haystead’s work on this led to HIV drugs.
However even if you find a drug and know it works you’ve still got to get it though the trial process, with various phases to show safety, efficacy etc. That takes the best part of a decade (does not apply to Covid vaccines ofc… and it won’t apply to whatever they want to Inject you with next.)
There’s a really good article waiting to be written to answer that question. ‘Lucky accidents in pharmacology.’