Each micro:bit has a unique five-character name assigned to it that you might see when you are using Scratch or connecting via Bluetooth. The names are hard-coded and based on their internal unique ID, so you can't manually rename the micro:bits.
Displaying the name of the micro:bit on the LED screen
You can find out the name of your micro:bit in MakeCode by using the `device name` block.
import machine import struct from microbit import display def microbit_friendly_name(): length = 5 letters = 5 codebook = [ ['z', 'v', 'g', 'p', 't'], ['u', 'o', 'i', 'e', 'a'], ['z', 'v', 'g', 'p', 't'], ['u', 'o', 'i', 'e', 'a'], ['z', 'v', 'g', 'p', 't'] ] name =  # Derive our name from the nrf51822's unique ID _, n = struct.unpack("II", machine.unique_id()) ld = 1; d = letters; for i in range(0, length): h = (n % d) // ld; n -= h; d *= letters; ld *= letters; name.insert(0, codebook[i][h]); return "".join(name); display.scroll(microbit_friendly_name())
Finding the name of the micro:bit from the pairing pattern
You can also find the name, by looking at the barcode in pairing mode:
Also see How to find the serial number of your micro:bit
The name is set in the micro:bit runtime and derived from the micro:bit's serial number, so it is individual to the device and you cannot change the name of the micro:bit.
Further discussion can be found in this GitHub issue https://github.com/lancaster-university/microbit-dal/issues/306