The sound-producing unit of headphones converts audio signals (electrical energy) into sound by the interaction between the magnetic field created by a magnet and the coil carrying the audio signal. This interaction causes the headphone diaphragm to move back and forth, vibrating the air to produce sound.
The audio current flowing through the coil inside the headphones generates a changing magnetic field. This changing magnetic field interacts with the fixed magnetic field; like poles repel each other, while opposite poles attract each other. Because the intensity of the audio current constantly changes, the forces acting between these magnetic fields also constantly change, causing the headphone diaphragm to vibrate continuously, thus producing sound.
The magnetic field strength of headphone magnets is relatively small, and its impact on the body is negligible. However, it is recommended not to use headphones frequently, as wearing headphones creates a closed space in the ear canal, which can be more damaging to the eardrum.