Just curious of the exact model of your Mac and version of macOS. You can get this information by clicking the Apple menu and selecting "About This Mac".
I have been seeing issues where the screen brightness keeps dimming on the M-series Macs. I'll adjust the brightness to full and a little while later with the laptop not even going to sleep or locking the screen I will find the brightness has dimmed......sometimes to half. I have disabled the "Dim display" option when on battery. I haven't looked any further since these Macs are being managed by my organization so there is a slim chance they have configured some setting that I'm not seeing or is not shown in the GUI. I haven't been working with any Intel Macs to compare if it is definitely an M-series Mac issue or a macOS issue.
You can try clearing the NVRAM to see if that makes any difference. Within the Terminal app, enter the following command (it is safe for M-series Macs):
sudo nvram -c
You will be prompted for your admin password. Nothing will appear on the screen as you type the password, so press the "Return" key to submit the password. You may see "permission denied" messages for certain keys such as Computer Name, but if you don't see any error message regarding the failure of the command to execute, then reboot the computer in order for the system to pull the default values from the NVRAM on boot.
You can also try a DFU firmware Revive which resets the security enclave chip & system firmware. I doubt this will help here, but it is about the only other thing I can think to try other than reinstalling macOS over top of itself (even better would be to test a clean install of macOS without restoring from a backup...for testing purposes).
If this is something you can reproduce on demand, then you have have Apple or an Apple Authorized Service Provider examine the laptop. I know on my organization's Macs, this issue seems to be fairly easy to reproduce.
I think the problem is related to the light sensor. When the laptop senses less light in the room, macOS automatically dims the screen. I just haven't done any thorough troubleshooting to confirm this is the trigger. Theoretically once the laptop is in bright light, then the screen brightness should automatically increase. FYI, I have only seen this issue on my organization's managed laptops (MBAir M1).....I have not seen the issue on either of my two unmanaged M-series laptops (both MBPros) so I it may be a configuration issue or just an issue with the MBAir M1.
You can provide Apple with product feedback here:
Product Feedback - Apple
If you want Apple to take an active role in this, then you will need to open an official support case with Apple Support & ask to have the issue escalated if the first tier support agents are unable to resolve the issue. Just providing feedback won't get Apple to actively look into the issue unless enough people have also reported the issue.