There are two types of swapping involved
1) Guest OS Swapping.
2) The other type of swapping is done by ESXi Host.
1) One is guest OS swapping, in which the guest OS inside the VM swaps pages out to its virtual disk according to its own memory-management algorithms.
2) When other memory reclaim techniques like ballooning, TPS, Memory compression usage is consumed but still there is memory requirement then
ESXi is going to swap memory pages out to disk in order to reclaim memory that is needed elsewhere. ESXi’s swapping takes place without any regard to whether the pages are being actively used by the guest OS.