Hello,
One of my client needed to rename one of its web application. For the exemple, the name of the web application was "Demi" and he wanted to rename it to "Demo". To modify the name of the web application, use the following commands :
$webApplication=Get-SPWebApplication | where {$_.Name -eq "Demi"}
$webApplication.Name="Demo"
$webApplication.Update()
To verify that the name has been correctly modify, you can use the following command : Get-SPWebApplication | where {$_.Name -eq "Demo"}