Windows does not have that limit, that is a limit of the samaccountname. This attribute must be 20 characters or less to support earlier clients, and cannot contain any of these characters, we can't modify the length of the user's samAccountName.
https://learn.microsoft.com/en-us/windows/win32/adschema/a-samaccountname
But, you can use AD properties for user isolation rather than the username. If you created the user in ADUC with more than 20 characters, you were assigning a value to the "Name" of the user, which is the Common Name (the value of the cn attribute). This value can be up to 64 characters.
Check this case:
https://social.technet.microsoft.com/Forums/ie/en-US/2c4fa9be-4c11-4d28-9352-e71bb94d729f/change-the-default-windows-2008-r2-username-length-from-20?forum=winservergen
-------------------------------------------------------------------------------------
If the Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.