Port 5900: VNC
Port 5900 is VNC, a remote screen-sharing protocol, and the port Mac Screen Sharing uses.
What runs on port 5900
VNC servers listen on TCP 5900 (5901, 5902 and so on for extra displays) and send the screen to a viewer that can control mouse and keyboard. macOS Screen Sharing, RealVNC, TightVNC and many Linux desktops use it. The classic protocol only supports short passwords and no encryption.
On a home network
Macs with Screen Sharing or Remote Management on, Raspberry Pis with VNC enabled, and some NAS boxes and virtual machines listen on 5900.
If port 5900 is reachable from the internet
VNC should not be reachable from the internet. Researchers have repeatedly found many thousands of VNC servers online with no password at all, some showing industrial control screens and home desktops, and exposed ones are brute forced constantly. Use a VPN or a remote-access service with proper login instead.
How to check whether it is open on your network
On a Mac, check System Settings, General, Sharing for Screen Sharing and Remote Management. RECON's Exposure Check shows whether 5900 answers on your public address.
To find out whether port 5900 is open on something in your home, and whether the internet can reach it, the app scans your Wi-Fi from your phone and checks your public address from the outside. It says what it checked and what it could not. Get RECON for iPhone — one-time purchase, no account, nothing leaves the device.