The principle of a metal detector is quite simple.
Inside the machine are wire coils.
A transmitter sends an electronoc current throunhh the coil.
The current flow goes from clockwise to counter clockwise and back to clockwise again.
This current creates an electromagnetic field.