There are rust spots on the underside of the grating, why is that?

For some reason, iron-containing dirt has entered the drain and has stuck to the stainless steel grating. It can, however, be scraped off. The same phenomenon happens, if you leave a wet iron nail on a stainless steel countertop.