I have an ESXi and create two vlan networks, vlan 10 and vlan 20. VM1 connect to vlan 10 and VM2 connect to vlan 20. How can the two VMs communicate?
On a vSwitch you don't have VLANs - you have port groups.
Port groups can be associated with (external) VLAN IDs. Only vNICs on port groups associated with the same VID talk to each other. If you need vNICs on different port groups to communicate you need a router in between - this router can be virtual between the port groups, or physical between the VLANs.