When the magnetic contact sensor is opened, the input to pin 1 will be at logic "0", giving an output of logic "1" at pin 3 of U1A. Pin 5 of U1B will go "1" and pin 6 will be "1" as well giving an output at pin 4 a logic "0".
This will be inverted and a logic "1" will be generated at the base of transistor Q1. The transistor Q1 will turn ON and cause the buzzer to sound continuously until the reset switch S1 is pressed.