Are you sure it's the name you're forgetting and not the name that belongs to a certain face? I mean a lot of autistic people, myself included, have prosopagnosia, meaning difficulty to remember faces, no matter how long you have known them.
For example if someone from your work ran in to you in the other side of the town, in a place you've never seen him/her before and didn't expect to either, would you know that that person works with you, sits next to you in fact, yet you can't remember their name? If this is the case then you probably really do have trouble with names. On the other hand if this person walks up to you in that situation yet you have no idea who they are until they say their name, then the problem is most likely that you didn't forget the name, just the face.