How do prevent door from swinging open
It is a ball tip hinge. It is removed by placing a screwdriver under the "ball" but above the hinge leaf and driving it with a hammer in an upward fashion. This one looks in pretty good shape so it come out fairly easy. I have seen these kind be very difficult though. Once the pin starts out, that will expose the top of the pin that goes in the hinge leaf itself and a new inside corner to place the screwdriver to finish drive the pin upward.



Again it may be tough, but it will come out.

I would check the door for plumb with a level in both directions. On the face of the jamb, and on the face of the wall. In my experiences if the jamb or wall is out of plumb by more than 1/4" overall the door will open or close on its own, depending on which way the wall or jamb is out.

The proper way to correct it is removing and salvaging the trim resetting the door, and reinstalling the trim and repaint. Bending the pin a bit may do it, only because it is creating more friction against the movement of the door.

If the door only swings open a little, it may be "hinge bound" where the jamb and the door are meeting each other, whether it is from paint build up or improper installation of the door, leaving no gap at the hinge side. I check this by watching the hinges very closly while the door is closing and if the hinges move in the slightest, that hinge needs attention to get a gap there so it binds no more.