High binding affinity and selectivity of metal ions are essential to the function of metalloproteins. Thus, understanding the factors that determine these binding characteristics is of major interest for both fundamental mechanistic investigations and guiding of the design of novel metalloproteins. In this work, we perform QM cluster model calculations and quantum mechanics/molecular mechanics (QM/MM) free energy simulations to understand the binding selectivity of Ca2+ and Mg2+ in the wild-type carp parvalbumin and its mutant. While a nonpolarizable MM model (CHARMM36) does not lead to the correct experimental trend, treatment of the metal binding site with the DFTB3 model in a QM/MM framework leads to relative binding free energies (ΔΔGbind) comparable with experimental data. For the wild-type (WT) protein, the calculated ΔΔGbind is ∼6.6 kcal/mol in comparison with the experimental value of 5.6 kcal/mol. The good agreement highlights the value of a QM description of the metal binding site and supports the role of electronic polarization and charge transfer to metal binding selectivity. For the D51A/E101D/F102W mutant, different binding site models lead to considerable variations in computed binding affinities. With a coordination number of seven for Ca2+, which is shown by QM/MM metadynamics simulations to be the dominant coordination number for the mutant, the calculated relative binding affinity is ∼4.8 kcal/mol, in fair agreement with the experimental value of 1.6 kcal/mol. The WT protein is observed to feature a flexible binding site that accommodates a range of coordination numbers for Ca2+, which is essential to the high binding selectivity for Ca2+ over Mg2+. In the mutant, the E101D mutation reduces the flexibility of the binding site and limits the dominant coordination number of Ca2+ to be seven, thereby leading to reduced binding selectivity against Mg2+. Our results highlight that the binding selectivity of metal ions depends on both the structural and dynamical properties of the protein binding site.