White cotton rarely fails all at once. It goes grey slowly, because soil from skin and deodorant is not fully rinsed out and then gets baked in by the dryer. Three small changes fix most of it.
1. Wash white separately, but not too hot
Whites need their own load so dye from other clothes cannot settle on them. A 40°C cycle with a longer rinse is usually enough; going straight to 60°C every time wears the cotton thin and sets protein marks.
2. Pre-treat the collar and underarm
Work a small amount of liquid detergent into the collar band and underarm area ten minutes before washing. Those two zones hold most of the soil and never get enough mechanical action from the drum.
3. Skip the dryer when you can
Line drying in indirect sun keeps white cotton bright. If you do use a dryer, take shirts out slightly damp and press them — the heat that dries them completely is also the heat that fixes any remaining soil into the fibre.
Once a month, run a maintenance wash on the machine itself. Detergent residue and lint build up in the drum and transfer straight back onto the next white load.