The doors lock when you start driving.
The doors also lock on their own if you don't open the door within 30 seconds. They do this so if you accidentally press the unlock button while walking away, the car will lock itself.
If you unlock them and you DO open the driver door within 30 seconds, try unlocking them and opening the passenger front door. If the car doesn't lock within 30 seconds then the driver door handle switch is bad and not telling the car you opened the door. It thinks the door was never opened so it auto locks it.