When you put two different metals into your mouth, under some conditions you can form a simple battery and actually generate a small current.
If you have silver fillings (i.e. dental amalgam — mercury, silver, tin, and copper), along with jewelry containing a noble metal (i.e. one that doesn't corrode such as osmium, titanium, platinum, niobium, gold, etc.), you can get electrogalvanism happening (with your saliva being the battery's electrolyte). Side effects can include:
- Blackening and breakdown of your fillings
- Pain and burning sensations (i.e. galvanic pain)
- A metallic taste in your mouth
- Change in color of the jewelry (i.e. anodization)
In most people these symptoms simply go away with time, but some people experience more extreme reactions including headaches, generalized pain, itching, nausea, dizziness and so on (which could make you falsely believe it's a brain infection).
Assuming it doesn't go away in time, switching to an alternate jewelry material will usually help. Getting polymer fillings rather than dental amalgam will also typically eliminate the problem as well. Note that in rare cases this can also happen if you're wearing multiple pieces of oral jewelry using different metals.