The encrypted APFS volume requires the password to unlock the drive so that you can access the drive data with full privileges. If you log out of the current user account and the APFS volume ejects, and you can't mount it via VNC, there is a solution to solve this problem.
When you format an external hard drive on Mac, you can choose to encrypt the drive with the options of file system. Both APFS and Mac OS Extended(Journaled) provide such options. If you have an encrypted APFS volume, you need to enter the password so that you can access it. That may also explain why it ejects when you log out of the current user account, for the purpose of preventing the drive from unauthorized access.
If this troubles you when you try to access the drive via VNC and every time you need to manually mount it given that the drive is automatically ejected when logging out. Then you can site the volume in /etc/fstab with the 'auto' option, then it will not be unmounted during user logout.
When determining the mount point for a filesystem, the user-defined mount points, indexed by the filesystem, are found in the file /etc/fstab. The constructs "UUID" and "LABEL" respectively can be used to identify each filesystem by its UUID or by its label.