Either a user has changed their name and it does not update in Sharepoint.

Or an old username has been re-used (new user has the same name)


Looks fine in AD, Office 365 etc, however sharepoint still thinks its the old username or the old user.
In the case of the old user, this means the new user cannot access sharepoint files when added to the permissions


To update you need to connect to the sharepoint module in powershell


Connect-SPOService https://imgroupltd-admin.sharepoint.com


Now run 


Get-SPOUser -loginName hsmith@imgroup.co.uk


It will ask for a site to enter, eg


https://imgroupltd-admin.sharepoint.com 


It will then display this 



In this case the display name is correct. However when you enter a different site, eg the Finance Documents centre it shows as Holly Smith (the old user)



To correct use the command 


Set-SPOUser -loginName hsmith@imgroup.co.uk


Enter the site to apply the change. It should show the updated name, can run the Get-SPOUser command again to confirm



Now you can add the user into the permissions for the Site/Libraries