Here is a quick explanation of how auto-dimming rearview mirrors work.
Auto-dimming rearview mirrors employ a sensor often located on the back side of the mirror. With this, the device can discern the amount of light emerging from behind your vehicle. When a bright light gets detected, like the headlights from another vehicle, a signal goes to the microcontroller inside the mirror.
Once the microcontroller receives the signal, it sends an electric current past electrochromic gel setup between two pieces of glass. The current causes a color change and opacity shift in the gel that makes it darker and not as reflective. The glare on the rearview mirror diminishes, and your eyes remain protected from strain.
When the sensor notices less light, it will reduce the electric current, and the gel forms back to its original state. You can always see what happens behind your vehicle without manually adjusting the mirror.