  Planets grow in rotating disks of dust and gas around forming stars, some of
which can subsequently collide in giant impacts after the gas component is
removed from the disk. Monitoring programs with the warm Spitzer mission have
recorded significant and rapid changes in mid-infrared output for several
stars, interpreted as variations in the surface area of warm dusty material
ejected by planetary-scale collisions and heated by the central star: e.g., NGC
2354-ID8, HD 166191 and V844 Persei. Here we report combined observations of
the young (about 300 Myr), solar-like star ASASSN-21qj: an infrared brightening
consistent with a blackbody temperature of 1000 K and a luminosity of 4 percent
of that of the star lasting for about 1000 days, partially overlapping in time
with a complex and deep wavelength-dependent optical eclipse that lasted for
about 500 days. The optical eclipse started 2.5 years after the infrared
brightening, implying an orbital period of at least that duration. These
observations are consistent with a collision between two exoplanets of several
to tens of Earth masses at 2 to 16 au from the central star. Such an impact
produces a hot, highly-extended post-impact remnant with sufficient luminosity
to explain the infrared observations. Transit of the impact debris, sheared by
orbital motion into a long cloud, causes the subsequent complex eclipse of the
host star.
