So far, we have discovered more than 4,000 exoplanets. "Exoplanet" here means "outside the solar system" - still within the Milky Way. Although there are definitely planets in other galaxies, it is not easy to find "exoplanets", and it is even more difficult to find planets outside the Milky Way.
However, in 2020, astronomers may have discovered the first extragalactic planet through the space telescope of the Chandra X-ray Observatory in the United States. The possible planet, now named M51-ULS-1b, is located in a spiral galaxy called M51, 28 million light-years away.
Astronomers didn't directly observe it. They found it while looking for clues about the "transit phenomenon" in the space telescope's 2,624 observations. A "transit" is the change in brightness that occurs when a star or other bright object is obscured by a transiting planet.
The planet appears to be orbiting in a binary system consisting of a star and a black hole or neutron star. It may be a gas giant a little smaller than Saturn, at least as far from its parent star as Saturn is from the sun.
This gave us trouble confirming its identity. Because for planets discovered through transits, the prevailing rule in the international astronomy community is to repeat the observation at least three times to confirm that this is a periodically rotating planet. However, if the possible planet is so far away from its parent star, its next transit may not occur until decades later.