When you build a gun turret and you have the required ammo type and amount in your inventory, it's immediately loaded into the turret. Otherwise, the turret is placed empty as normal.
The ammo type and amount can be set in the mod settings. In vanilla Factorio, the ammo types are:
firearm-magazine
piercing-rounds-magazine
depleted-uranium-magazine
Set the amount to 0 to disable automatic loading.
It doesn't take ammo from a weapon you have equipped.