Just by covering your ears, headphones help block the sounds around you. But active noise cancellation takes a little bit more work.
Different sounds have different waveforms. And a microphone on noise cancelling headphones registers the waveforms coming from the sounds around you. Then, the headphones create a new waveform thats the opposite - the antiphase of the original sound. By adding the two waves together, they cancel each other out in whats called destructive interference. And the result is glorious silence.
It can be tricky to get the antiphase just right, and to keep pace with abrupt noises. So active noise cancellation works best with continuous and low frequency sounds like plane engines.
Critical thinking challenge: Why are noise-canceling headphones most effective against noise from plane engines? Is it because the engines are so loud?