Disconnect all external devices in case one of them is causing a problem.
Try booting into Safe Mode to see if the installation will finish. Safe Mode prevents third party software from automatically launching during login & boot and is the most likely cause for the problem.
Before even attempting to upgrade macOS or even fix the laptop, make sure you have a good backup just in case something goes wrong. With an M1 Mac, there is no way to recover data from the SSD which is integrated into the Logic Board.
You can also try running Disk Utility First Aid on the hidden Container. Within Disk Utility you may need to click "View" and select "Show All Devices" so that the hidden Container appears on the left pane of Disk Utility. Select the Container which holds the multiple APFS volumes such as "Macintosh HD" and "Macintosh HD - Data". Even if First Aid says everything is Ok, click "Show Details" and scroll back through the report to see if any unfixed errors are listed. If there are any unfixed errors listed, the run First Aid from Recovery Mode, otherwise you will need to erase the Container and reinstall macOS & restore from a backup.
How to reinstall macOS - Apple Support
Use Disk Utility to erase an Intel-based Mac - Apple Support
You should always have frequent and regular backups of your computer and all external media (including the cloud) which contains important & unique data.