You can rename your current ship just by going to its status screen (where you have its weapons, console, etc. loadouts) and hitting the rename button. You can do this for other ships at any of the dockmaster NPCs.
In any case, it will only cost you energy credits. However if it is your first rename for that ship (as in you took whatever default name came up for your ship initially), it should still be free. The same applies for the registration number for Federation ships.
You get 1 Rename for free. You do that by hitting U and bring up the ship display UI. At the bottom of the screen you'll see a tab that says Rename. Click that and it will allow you to change your ship name.