What you wish to change is the device's
hostname. On certain ROMs such as LineageOS, you may do so via the
Device hostname setting, located inside the
Developer options. You can access them by typically tapping the
Build number information, placed inside the
About phone setting, seven or more times.
Device hostname setting is missing, you may achieve the same result by either using a computer and sending commands via
adb, or by installing a terminal emulator app.
While I won't cover the topic of setting adb and USB debugging on, the command to use with adb is
adb shell "setprop net.hostname <hostname>"
If using a terminal emulator, instead, the command to use is
setprop net.hostname <hostname>
In both cases, replace
<hostname> with a name of your choice, and press the Enter key to run the command.