Confluence does not provide a function to change the username via the web or remote interface.
Since it is not guaranteed that users will be stored in the confluence database (eg. using external user management), the username instead of an id is used as the foreign key. Therefore if you need to update the username, you will have to update every occurrence of the username used as foreign key in all tables. This procedure should be automated to avoid corruption in the database due to mistakes made in the process.