Help Understanding a PCB Circuit from Cordless Hot Glue Gun
I also recommend you to draw a schematic in the CircuitLab editor. Then you can simulate this and understand it. 
For what I can see here, this is some simple output voltage regulator. The gate of the mosfet is driven according to the current output voltage.