A fresh egg has a natural anti-bacterial covering on it, called the bloom. When you see an egg being laid it comes out wet, then dries in about a minute. That wetness is the bloom. This is the Creator's way of keeping eggs unspoiled in the nest while they wait for the mama bird to complete her clutch before beginning to set. And also to keep them unspoiled while they incubate.
We benefit from this by having eggs for eating that can keep unspoiled for a week or more at room temperature. Many of us will keep the eggs we get for home use on a counter, unwashed so that the bloom will keep them safe. But if they must have some dirt or poop washed off, we'll then put them in the refrigerator since the bloom will also be gone.
If it's just a bit of dried poop or mud you can even just scrape it off with a bit of sandpaper. To give them a wash, use water warmer than the temp of the egg, so that you're not causing the egg to suck in bacteria through its pores. It has something to do with osmosis, if you can remember it from biology class, my memory of it is dim. I use warm running water and a plastic scrubby.
Hens, and I guess all birds, have a way of laying their eggs so that they stay clean and poop-free. Their egg-laying parts sort of invert and push the poop-making parts closed while the egg emerges. But I guess that some hens' parts don't work as well as intended, or as they get old their elastic starts to stretch. It's really a wonderfully-designed system.