When the lock screen is active (it can e.g. be activated with Ctrl+Alt+L) the username is shown. How can I remove the username from the lock screen? I want the lock screen to simply not display the username.
In short, you can't do that; but you can workaround it depending on your needs.
gnome-screen-saver displays your user name; that is, your full name, not your account name.
You can change your user name, but you have to think about the ramifications. If your main concern is not having your name visible in public, set your user name to your first name only, a fake first name, or just to me. But remember that this user name will be used in the drop-down list from the power button and wherever else a program retrieves the user name.
On a single user laptop, this is probably not going to cause any trouble. But on a shared computer, you need to know who is logged in when you look at the screen, so you would at least need something liker User 1, User 2.
User Accounts will accept and display an invalid string but I imagine it sets your user name to null in
/etc/passwd since the drop-down list of users shows a blank line. This breaks the user list and you will not be able to lock, log out, or restart from the GUI. (Think about it, the system is trying to authenticate these actions for...who?, plus I experimented a little.)
On top of that, the lock screen will default to your account name, which is really defeating what I imagine is your purpose. So no null string, a string of spaces, a string not starting with a-z, a string more than 31 chars, or a string less than 2 chars. (This last seems to be a Gnome/Ubuntu add-on to the Linux requirement of at least 1 char.)