I found this piece of circuit in a battery powered sensor. It's a magnetic door sensor.
I am not able to figure out what does this do?
It's battery reverse polarity protection like this circuit: -
When the battery is connected correctly, the PMOSFET turns on and acts like a low ohmic path for current to the load. If the battery is reversed, the gate is higher than the source in voltage and the PMOSFET does not turn on thus, it "protects" the load.
The gate resistor is optional and is not needed for batteries of lower voltage than typically 10 to 15 volts but if the battery were 15 volts or more, the resistor AND an added zener diode would protect the gate-source region getting too much voltage and breaking down: -
It's probably a good idea to have a resistor anyway because it does offer some ESD protection to the gate (that would otherwise be directly connected to a battery terminal and could be vulnerable).
Is there more to the circuit, what does the 3V power?
It is difficult to answer the question without knowing what else is there, however, here is a shot:
The MOSFET is used to ensure 3V power to the 3V node even in the case of mis-connection of the battery. Under normal connection, the body diode of the MOSFET powers up the 3V node, assuming that NC on R14 means that it is not connected (or not mounted). In case the battery is inserted incorrectly (basically, inverted), the GND in the circuit becomes 3V, the MOSFET switches on and connects the negative of the battery to the 3V node. This way, the circuit still works, without blowing stuff. The capacitors seem ceramic/non-polarized and should work with reverse polarity. The LC filter would be useless though...
Again, shot in the dark, without the remaining part of the circuit, I cannot validate my hypothesis.