A threshold, a flood fill, and why that is enough
The tool first works out which color the background is: it looks at the pixels around the border, finds the shade most of them agree on, and uses that. You can override it with white, black, chroma-key green or any color you type in.
Then it walks inwards from the edges. Every pixel close enough to that color becomes transparent, and the walk stops at the first pixel that is not - which is what makes the flood fill smarter than a global color replacement. A white shirt on a white background survives, because the fill cannot reach it without crossing the subject. A green screen wants the other behavior, so there is a mode that removes the color anywhere in the picture instead.
The alpha channel is then multiplied by that mask, so the subject is not redrawn: the pixels that stay are exactly the pixels that were there. What you see in the preview is the file you download.