NASA’s Hubble Space Telescope got a rare look at the aftermath of two cosmic collisions — and helped scientists solve a decades-old mystery.