While booted from the installer (Internet Recovery Mode or USB installer) you need to launch Disk Utility and erase the whole physical drive (Intel only) as GUID partition and APFS (top option). Quit Disk Utility and select the "Reinstall macOS" option. This assumes an Intel Mac where you are installing macOS 10.13+.
You can boot into Internet Recovery Mode using Command + Option + R, or you can create & use a bootable macOS USB installer.
How to reinstall macOS - Apple Support
How to create a bootable installer for macOS - Apple Support
If you are using a 2018+ Mac and you have access to another Mac running macOS 10.15+, then you can "Restore" the firmware to push a clean new OS to the internal SSD:
Revive or restore an Intel-based Mac using Apple Configurator - Apple Support
Revive or restore a Mac with Apple silicon using Apple Configurator - Apple Support
Erasing the drive or "Restoring" the firmware destroys all data on the drive.