The VMs are unable to communicate when on different hosts due to a misconfiguration (usually VLAN) in the upstream network that caused the packets to drop before being given to the destination VM's host. ESXi cannot process or forward a packet that it does not receive.
The VMs can communicate when on the same host (if on the same virtual switch and portgroup/VLAN) because the packets going between VMs in this scenario do not leave the host, so the physical network misconfiguration is not in the datapath.
Engage the administrator or team who manages the relevant physical network devices (chassis and/or switches) between the ESXi hosts to correct the misconfiguration.
If additional assistance is needed with troubleshooting, create a Support Request using the instructions at Creating and managing Broadcom support cases.
See also:
Troubleshooting virtual machine network connection issues
Troubleshooting VMware vSphere ESXi Virtual Machine TCP/IP, ping connection issues
VLAN configuration on virtual switches, physical switches, and virtual machines