By default, the swap file is created in the same location as the virtual machine's configuration file, which could either be on a VMFS datastore or a vSAN datastore. On a vSAN datastore, the swap file is created as a separate vSAN object.
A swap file is created by the ESXi host when a virtual machine is powered on. If this file cannot be created, the virtual machine cannot power on. Instead of accepting the default, you can also:
Use per-virtual machine configuration options to change the datastore to another shared storage location.
Use host-local swap, which allows you to specify a datastore stored locally on the host. This allows you to swap at a per-host level, saving space on the SAN. However, it can lead to a slight degradation in performance for vSphere vMotion because pages swapped to a local swap file on the source host must be transferred across the network to the destination host. Please note that currently a vSAN datastore cannot be specified for host-local swap.