Depends on whether or not the pet you're trying to name is still unnamed.
If it is, you just have to use a tag to rename the pet that has the name you wanna give to your target pet.
If it isn't, you'll need two tags - one to rename the pet with the name you're moving and then one to use on the target pet, to give it the name.
Also, if you're dealing with the second case but don't wanna buy two tags, it's possible to let the pet you wanna give the name to die, so that it'll lose its name. Thus, it becomes unnamed and you only need a tag to make the name you're putting on it available.
Don't kill both pets though. I mean, you can do it that way to avoid tags completely, but it's also really risky. Someone might notice your dead pets and take the name you actually want to keep - especially if it's valuable.