Here's why:
* Meteoroids are common: Space is filled with small rocks and debris (meteoroids) left over from the formation of the solar system. These objects constantly travel through space and can collide with planets.
* Earth's atmosphere: Earth has a thick atmosphere that protects us from most small meteoroids. They burn up in the atmosphere as "shooting stars" before they can reach the surface. However, larger meteoroids can still penetrate the atmosphere and cause impacts.
* Mercury's lack of atmosphere: Mercury has a very thin atmosphere, offering almost no protection from meteoroids. Therefore, many more meteoroids hit its surface.
In short, Mercury gets hit by more meteoroids because it has almost no atmosphere to burn them up.
It's worth noting that both planets have been heavily cratered by past impacts. Mercury's surface is especially scarred because it's had billions of years to accumulate impacts without much atmospheric protection.