When no cartridge is present, the firing pin strikes nothing. With a rimfire, though, the firing pin is positioned to strike the soft brass rim of the cartridge. When no cartridge is present, the firing pin strikes the hard steel of the breechface. Repeated dry-firing of a rimfire can eventually peen the firing pin, dulling it and causing misfires.
The firing pin/striker NEVER strikes nothing. It always hits something.
When there's a live round chambered, it hits the primer or cartridge rim. When there's not a live round chambered it hits either the breechface, the edge of the chamber (rimfire) or a firing pin/striker stop.
The primer or rim is much softer metal than the firing pin and the crushing effect cushions the impact to some extent. When the firing pin/striker is stopped by a steel part, the impact force is much greater because there is no cushioning effect.
The damage that occurs from firing a rimfire that doesn't have a firing pin stop is typically to the chamber edge, not to the firing pin. The firing pin is typically much harder than the breechface or chamber. The hardened firing pin will strike the softer steel around the chamber. Eventually this damage can push enough metal out into the chamber area that a cartridge can't be chambered. Clearing out that peened metal will allow a cartridge to chamber, but there is metal being pushed away from under the firing pin by the peening and eventually enough metal can be moved that the firing pin can no longer pinch the primer in the rim sufficiently to fire the cartridge.
Anyway, the gist of all of this is that when there is no live round chambered, something else must stop the firing pin, and, depending on the design of the firearm, either the firing pin or whatever is stopping it can eventually be damaged by a sufficient amount of dryfire.
This isn't really a complicated topic, but it does get contentious because there are some people who don't understand that just because something is OK doesn't mean it is OK to do it hours and hours every day for months or years.
Dryfiring in 5 simple rules:
1. Dryfiring stresses certain parts of the gun in different ways than live fire does. Some guns are designed to tolerate that stress (to one extent or another) some are not.
2. EVERYTHING breaks eventually. Even a gun designed to tolerate dryfiring can eventually be broken with a dedicated effort. A blurb in the manual stating that dryfiring won't hurt the gun isn't a guarantee that the gun will hold up to an hour of dryfire practice every night for the next several years.
3. Some rimfires can be damaged by even one dryfire. These should not be dryfired at all as there really aren't effective snapcaps for rimfires.
4. Older centerfire guns may not be designed to tolerate dryfiring. If you have a gun that is 40 years old or older, it would be wise to do some research before dryfiring it. It would be wise to dryfire it only with snapcaps even if the research says it's safe to dryfire, and it would be wiser still to do your dryfire practice with a modern firearm approved by the manufacturer for dryfire.
5. Not all guns are the same. Even some modern firearms may have prohibitions against dryfiring. Read your manual.
One simple rule for dryfiring other people's guns (including while shopping).
1. Ask before you dryfire someone else's gun.