If you don't want the door to open automatically, but you do want it to unlock:
Passive entry is the correct setting to enable for automatic unlocking, caveat: if you have an older model with a repeatable fob (vs card keys plus an accessory bluetooth fob or phone key), passive entry allows a team with the correct equipment to drive off with your vehicle by having someone near you capturing he foob signal and someone at the vehicle rebroadcasting it. You can use the PIN to drive feature to counter this attack method.
Automatic doors should be disabled if you don't want them to open when you haven't pressed the door button, caveat: it's all or nothing, once automatic doors is disabled, double-clicking the fob will not open the doors, either.
If what you are seeing doesn't match up with these descriptions and also isn't consistent, the inconsistent unlock behavior you describe could indicate it's time for a new fob battery, but I've had bad luck changing those myself.
Personally, I turn passive entry off and leave automatic doors on, this allows me to open them with the fob but not have the driver door open based on presence of the fob because my X is always locked until I unlock it.