It's called an axle nut in bicycling parlance. In general terms, it's a type of flange nut.
Like most things bicycling, there's little standardization of these. The most useful reference is here at Park Tool's site.
It could be a 5/16 inch x 24 tpi, 3/8 inch x 24 tpi or 8mm x 1mm. Or some weird other variant. The likelihood of finding the right one at a hardware store is low and you might accidentally jam or cross-thread it if you force it. For example, some axle nuts are 26tpi which will thread part way then jam.
Your local bike shop will likely have a big box of old axle nuts that you can sort through. If they don't, find an bike shop that is older and dirtier. The less teeth the mechanics have (both oral and on their steeds), the better.
If the nut is safe and working okay in its task, there's nothing functionally wrong with leaving it as-is.
One bonus is that it helps uglify the bike (cos a rusty bike is less worth stealing)
Personally I'd wire-brush the worst of the rust off with a brass bristle brush.
Then I'd apply some rustblaster converter to make the red iron oxide into stable black iron oxide. Leave to set for a day.
For handlebars and stems I then sand the item, apply a light spray coat of one-coat primer/topcoat matt spraypaint. That is left to dry for a day, or if I'm in a hurry I wait an hour or two and then hit it with a hot air gun and then another hour to cool down.
Then another light sand, and a top coat of either gloss, semigloss, or matt spraypaint to match the bike's look. Shiny looks nice, but some things suit the dull look. Again another period of drying and hot air.
I do not generally clear-coat bike parts.
For your nut, I'd probably stop after the rust converter.