Close the door and review it from a few feet away. In some cases, the door swings shut because it’s uneven and hanging at an angle toward the side that opens.
Place a rolled up newspaper underneath the door to keep it held up and open. Make sure you’re standing on the side where you can work with the hinges.
Screw the hinges assembly back securely into the door frame if they’re loose. This is a common reason for a door that hangs unevenly. Test the door to see if that fixes the issue. If not, continue to the next step.
Remove the topmost hinge pin. Either use a pair of pliers or place a nail at the bottom hole and tap the pin upward.
Place the hinge pin on a concrete surface, such as your garage floor, and tap it so it bends ever so slightly.
Hammer the hinge pin back into the hinge assembly gently. Test the door as if you’re entering the room — it should hesitate or stay open after you walk through instead of swinging shut. If not, do the same thing for one or both of the other hinge pins to fix the issue.