Click the Apple Logo in the top left corner of the screen and select System Preferences:
In the window that appears select Sharing:
This will move to a new page, showing the name of your computer.
Info
title
NB: macoS Ventura Differences
On macOS 13 (aka "Ventura"), the settings are organised slightly differently.
Go to Apple logo > System Settings > General > Sharing and scroll until you see your computer name listed under Hostname at the bottom of the settings pane: