Like ducky says, the first thing is acceptance. It's a real thing, it's not just in your head and beating yourself up about it isn't going to help. We do the best we can and what that is might change from one day to the next.
For me, brain fog seems to be tied to allergies/sinus pressure/migraines and inflammation. It took me over 10 years to work that out because it didn't feel like allergies (no sneezing, no itchy eyes). It just feels like trying to think through a wet blanket (or if bad enough just wanting to lie down and do nothing). What I eat also has a big impact on how sensitive I am to allergens from one day to the next.
Some things you may want to check you're getting enough of (everyone's body is different):
- Magnesium is critical for many bodily processes including brain function. Magnesium supplements are known to help reduce migraine frequency and I've found really help clear up some of the feeling of brain fog. The recommended daily intake is around 400 mg (though don't try to use magnesium oxide—that's a laxative!).
- Vitamin B12 and Vitamin B9 (Folate) are both critical to normal metabolic function. If you have a deficiency then your body isn't able to create new proteins, DNA or protect cells/organs from oxidative damage.
- Iodine deficiency is becoming an increasing problem in developed countries as people move away from iodized table-salt. This can result in hypothyroidism and interfere with your bodies ability to regulate immune response.
- Potassium is also critical for many bodily processes, including brain function. Many people (at least here in the US) fall short of the recommended daily intake. I find it I don't get enough in my diet then my allergies tend to flare up more easily.
- Omega-3 Fatty Acids are an important component of cell membranes in the body, including the myelin sheath that allows the fast, efficient transfer of electrical impulses in the nervous system.
Brain fog can also be associated with chronic illness (like long covid or a long running persistent infection), so it's well worth talking to your doctor about.