If you're unable to erase your M1 Mac in Disk Utility after booting from a USB installer, try the following solutions:
① Erase your M1 Mac via "Erase All Contents and Settings."
Disconnect the bootable USB and restart your Mac from the internal hard drive if available. Then go to the Apple menu > System Settings > General and click Transfer or Reset > Erase All Contents and Settings.
② Boot into Local Recovery or Fallback Recovery to erase your M1 Mac.
③ Use "Erase Mac…" in Recovery Assistant.
Shut down your Mac completely, press and hold the power button until you see the "Loading startup options" message, then click Options > Continue.
You'll be asked to choose the admin account and enter the password if you have FileVault enabled. But instead of doing so, you can click the Recovery Assistant at the top-left cover and choose "Erase Mac…" to erase your internal hard drive.