How to remove shared devices from my iMac?
Firstly, shared devices that appear in the Sidebar are:


other devices you have at home that are connected to the same network as your Mac.
other computers signed into your iCloud account. 


And a network doesn't mean you have to have multiple computers or that you're somewhere other than home. 

For example, most times users come across an unknown shared device in their Sidebar it's because it belongs to a printer that is also connected to the same Wi-Fi network as their Mac is. That is, if you have a single Mac at home connected to Wi-Fi, then that Mac is connected to a network. 

Without knowing your setup at home I can't comment on what the shared device is, but it could be any device that's connected to the same Wi-Fi network (assuming you're using Wi-Fi), or any device connected to the same internet connection at home. So it could be a printer, a smart TV, a weather station, etc.

So, if you're concerned that there's some sort of dodgy device trying to connect to your Mac, that's almost certainly not the case.

If your main concern is that you just don't want to see Shared items, then you can hid these as follows:


Open Finder
Go to Finder > Preferences...
Select the Sidebar icon in the toolbar 
Modify your settings under the Shared section
Exit Preferences


Removing &#39;shared&#39; section in Finder programmatically