Sorry there is no way to rename nextcloud username/account at the time of the writing (20.0.6).
I once needed to fix a typo I made in Nextcloud username and ran into this sad fact.
However after some digging I found that one could create a new account and then transfer files / data from old account to the new one -> which worked for me.
Keep in mind this approach does not transfer apps and settings, just files.
Create a new user
Create a new user with newusername that you want to change your oldusername to.
You can do this in nextcloud web gui.
I tend to use containers for everything, so to execute following command I do need to jump into docker container:
docker exec -it nextcloud bash
Transfer files using occ command:
root@d1919d573698:/data# occ files:transfer-ownership oldusername newusername Validating quota Analysing files of oldusername ... 16404 [============================] Collecting all share information for files and folders of oldusername ... 0 [------------->--------------] Transferring files to newusername/ files/transferred from oldusername on 2021-01-01 19-37-47 ... Restoring shares ... 0 [>---------------------------]