Is there a deterministic one-way collision-free crypto algorithm?
At SEJPM indicated, MD5 and SHA-1 probably are resistant enough for you never to get a collision. However, that doesn't mean that either of them is secure. Neither is SHA-2 or SHA-3. That is, given that the usernames do not have a special structure that makes them hard to guess.

The problem is that user names can - generally - easily be guessed. So whatever you do to them, a deterministic algorithm will expose them. You can just perform a dictionary attack and find the resulting value in the set of stored user names. This way most usernames will easily be found.

If you want to protect them you may need a second system (trusted third party, an entity other than the user or service provider) that performs username encryption / decryption or password hashing with a pepper - a secret value just like a key.

But in general it is better to make sure that knowing the username gives the adversary few - if any - advantages. This is the case in the majority of cases, although may systems may not indicate if a username or password is incorrect - making guessing of the combination of both just that little bit harder.