There are many asteroids floating around in the solar system, and sometimes one passes extremely close to Earth.
NASA, along with other official bodies around the world, are tracking all of the asteroids that are considered a "threat" to Earth. For an asteroid to be considered a "threat", it must be more than 460 feet in diameter, and luckily 90%+ of the asteroids that are this width or more are currently being tracked. The smaller asteroids are much harder to track, and sometimes researchers are unaware that they even have had a close flyby with Earth.
Asteroid 2021 UA1 is a prime example, as researchers didn't know it had come extremely close to Earth until after it passed by. Asteroid 2021 UA1 measures 6.6 feet in diameter, and on October 24, it passed over Antarctica within 1,800 miles of Earth. Researchers didn't know that the small asteroid was on its way because the asteroid approached from Earth's daytime side - the direction of the Sun. If you are interested in reading more about this story, check out this link here.