While you press the button, current flows from the internal pull-up resistor through the button to GND.
Therefore, the voltage of the button PIN drops to GND and reads 0.
When you release the button, the current loses that pass and doesn't flowed.
Therefore, the voltage of the button PIN is maintained at 5V coming from the internal pull-up resistor, so reads 1.