Classic multicast problem, by the sound of it. Home Sharing finds the computer over Bonjour, which is multicast traffic on the local network. A powerline adapter or a switch that filters multicast, or a wired path that lands on a different subnet from the Wi-Fi, will hide the Mac completely while everything else about the connection looks fine.
- Compare the IP addresses of the Mac and the Apple TV with the cable plugged in. They should match on the first three groups of numbers.
- Plug the Apple TV directly into the main router as a test. If the library appears, the powerline pair is the culprit.
- Check the router for client isolation, or a guest network quietly applied to that port.
- Confirm Home Sharing is enabled with the same Apple Account on both devices, since a mismatch produces the same empty result.
Wi-Fi working while Ethernet fails is the classic signature of a multicast or subnet split, not a Home Sharing fault.
https://support.apple.com/guide/tv/atvbc876df1e/tvos