I'm a bit confused on what you changed. It should be perfectly safe to change the long user name, but changing the short user name must be performed using another admin account using these Apple instructions:
https://support.apple.com/en-us/HT201548
To fix the problem now is a lot more difficult since you will need to boot into Recovery Mode (Command + R for an Intel Mac). Launch the Terminal app from the Utilities menu.
You will need to first disable System Integrity Protection (SIP) by issuing the following command (press the "Return" key at the end of each line to execute the commands):
csrutil disable
Make sure to re-enable SIP before rebooting so that your Mac is secure, otherwise bad things can happen (instructions are included later).
Now you need the volume name for your macOS boot volume. You can see a list of possible volume names where you should be able to recognize the macOS volume if it was renamed at some point from the macOS default of "Macintosh HD". Use the following command to see a list of volume names:
mount | grep -i volumes
Here is a command template to delete the ".AppleSetupDone" file which prevents Setup Assistant from running at boot time. Make sure to replace "Macintosh HD" in my example command with the actual volume name for your Mac's boot volume.
rm -i "/Volumes/Macintosh HD/var/db/.AppleSetupDone"
You will be prompted to confirm you want to delete the ".AppleSetupDone" file. You will need to type "y" or "n" for "yes" or "no". You also need to press the "Return" key to submit the response.
Now re-enable SIP (very important for the security of your Mac):
csrutil enable
Now reboot the Mac. You should now be greeted with Setup Assistant which will walk you through creating a new admin account. Once booted into the new admin account you can follow the Apple instructions to fix your main admin user account:
https://support.apple.com/en-us/HT201548
I'm writing this guide from memory. It has been a while since I have written up these instructions and personally tried it. I've never done this with Big Sur, but I did try it a couple years ago with Catalina which is very similar.
Your other option is to restore from a backup made before you attempted to change the user account name.
You should always have frequent & regular backups.