Sometimes we come across oven racks which look dirty, however the metal plating has actually been damaged. This leads to the metal beneath rusting.
This could be down to cheap chrome plating. Other racks may be stainless steel which again can lose their protection against corrosion. Once the metal protection is damaged then it is open to either chemical or moisture corrosion.
Either an over exposure to oven pride or similar products containing damaging Sodium Hydroxide AKA caustic soda. Another reason is that during cooking moisture is created inside the oven. If the oven door is not left open after the food is removed steam can condense. The steam from the cooked food will later condense to moisture. The oven may not be used for a few days and this can cause rust to appear if the chrome plating has been damaged. To avoid this problem leave the oven door open for 10 minutes after cooking.
Some oven racks can be damaged with the heat of a pyrolytic self cleaning oven, so always read the manual for the manufacturers recommendation.
So the solution to this problem is firstly to avoid using strong caustic cleaning products. Secondly, leave the oven door open after cooking to make sure there is no moisture left.
To avoid the mistakes that can lead to damaging your oven racks you might want to consider a professional oven cleaning company.