If it's an Azure virtual machine then the resource cannot be renamed. You would need to redeploy the virtual machine in order to choose a different name.
You can use tags instead to help identify the resource or use a friendly name after the resource name, here's how to do that: https://azureis.fun/posts/Adding-a-friendly-name-to-Azure-Resources/