Why renaming the folder does nothing
Minecraft treats the folder as an address and LevelName as the label. The world list, the server console, world-manager plugins and anything printing "world" to chat read the tag. So a folder copy — cp -r worlds/hub worlds/hub2 — produces two worlds that insist they are both hub, and the only fix is inside the file.
On a server the duplicate is worse than confusing. Plugins that resolve worlds by internal name can act on the wrong one: teleport pads, per-world configs, protection regions, economy multipliers. Rename the tag the moment you copy a world, before anything caches it.
Java single player
The client offers a rename in the world options screen and it edits LevelName for you. Editing the file by hand matters when the world will not load, when you are working on a copy, or when you want the folder and the label to differ deliberately.
Java server
level-name in server.properties selects the folder to load. It does not rename anything. Change LevelName in world/level.dat for the label.
Bedrock and MCPE
The in-game world edit screen renames the world. When the world lives on a server, or you are patching an exported .mcworld, edit LevelName in level.dat directly — Bedrock stores it flat at the root, uncompressed, behind the 8-byte header the editor handles for you.
Bedrock servers (PocketMine-MP, Nukkit, BDS)
Same file, same tag, and the same warning about stopping the server first. The server page has the full workflow including the folder-copy case.