There is possibly some idiom or saying like this, "If you try too hard for something, you will never get it. If you do not aim for something, it may fall on you accidentally, not as you originally planned."
In physics, or generally in science, there are many moments where success and triumph come from the accidental, unplanned attempts. Moreover, there are some cases that originally were attempts for one specific question or a goal, but solved another seemingly unrelated problem, or reach seemingly opposite goals. There are these kinds of moments leading to a breakthrough of physics or science.
Yang-Mills theory: The original paper has attempted to explain a theory of nucleons, such as neutron and proton interactions with isospin symmetry, but it turns out that Yang-Mills theory as a non-Abelian gauge theory is suitable to describe a more fundamental subject, the gauge fields coupled to quarks and leptons in the standard model (EM, and especially the weak interaction and the strong interaction.)
$Z_2$ topological insulator in 2+1D: the original paper of quantum spin hall effect from Kane and Mele is about graphene. But it turns out that the phenomenon is not present in graphene (C Kane jokes on this accident himself), but the physics is profound and correct, and later realized in CdTe/HgTe/CdTe quantum wells with a 2D film HgTe sandwiched.
[Question]: Can any of the readers here list more? Both in theory or in experiments. Making an inspiring list for eager-minded scientists at Phys.SE here. To give us some inspiration and high motivations to be subconsciously aware of those random accidental moments.