The below are my answers to from a similar question here: optimized battery charging not working Ma… - Apple Community
Note that the "~2 week period" I mention is jut the period of time that I personally observed myself. This may be different with other's situations and experiences.
Just my experience...I have my MacBook Air M1 on the charger 100% of the
time. If the charge cable is unplugged, whatever internal timer is used
with Optimized Battery Charging seems to get reset after ~2 weeks.
While connected to the charger, after the ~2 week period the MacBook will
slowly discharge itself to 80% and stay there and maintain the 80%. As
mentioned, the moment the charger is unplugged, then plugged back in,
the MacBook again will charge to 100% and stay at 100% for the ~2 weeks.
If you unplug the charger from the AC outlet or the USB-C charging cable
from the MacBook, some sort of timer gets reset. When this timer is
reset, the MacBook will charge to 100%. After the ~2-week reset period
with the MacBook always connected to the charger, the MacBook will then
slowly discharge to 80% and stay there until the charger is again unplugged
from the AC outlet or the USB-C charging cable is unplugged from the MacBook.
This resets the timer where you will again have to wait the ~2 week reset period.