A star in a distant galaxy blew up in a powerful explosion, solving an astronomical mystery