One troubleshooting technique is to create a new, empty User account on your Mac, and then boot with that User to test the machine. This can test for problems with startup items and corrupted existing User account files.
So, how do you make that test User go away when you are done?
To start with, you need to boot the machine with a User that has Administrative privileges (and not the user you are trying to delete)
You’ll see a list of users on the left. You’ll probably find that you cannot click on the other user names.
The secret is that you first have to click the locked padlock at the bottom left of the window, and use your admin account’s password to unlock changes. Once the padlock is unlocked…
Then you can select a specific User account name, and click the minus (-) button at the bottom of the list to remove that account. You will be given a choice of archiving the User folder data, or deleting it.
Problems deleting Users
If the Fast User Switching feature is turned on, you may have an issue deleting an account if it had been accessed prior to your last reboot. Click the toolbar menu near the upper right corner of your screen, which shows the Users (it may show either your full name, account icon and/or nickname), and select the account you want to delete from the list. Log into that account, and then select “Log Out” from the Apple menu. You can then delete the account from within “Users & Groups.”
If you still can’t remove the user, there may be an issue with the username, or with the operating system files, here is an Apple troubleshooting link https://support.apple.com/en-us/HT203513
Standard troubleshooting steps would be to turn off Automatic Login and Fast User Switching in the Users and Groups System Preference, then restart and use Disk Utility to repair Permissions, then try deleting the user again.