The Sharing might be on. To turn it off, go to System settings > General > Sharing > File Sharing/Screen sharing.
These settings can cause your computer to be available to other computers on your network by going to Finder > Locations > (Your computer's name). After turning off these settings, reboot your computer and under finder your computer should not be visible to other computers on your network.
| The setting paths are for the macOS Ventura settings. For older versions, use the search and search: File sharing OR: Screen sharing | If that doesn't work I don't know what else could be causing it.
Hope I could help!