The heme-AB binding energies (AB = CO, O2) in a wild-type myoglobin (Mb) and two mutants (H64L, V68N) of Mb have been investigated in detail with both DFT and dispersion-corrected DFT methods, where H64L and V68N represent two different, opposite situations. Several dispersion correction approaches were tested in the calculations. The effects of the local protein environment were accounted for by including the five nearest surrounding residues in the calculated systems. The specific role of histidine-64 in the distal pocket was examined in more detail in this study than in other studies in the literature. Although the present calculated results do not change the previous conclusion that the hydrogen bonding by the distal histidine-64 residue plays a major role in the O2/CO discrimination by Mb, more details about the interaction between the protein environment and the bound ligand have been revealed in this study by comparing the binding energies of AB to a porphyrin and the various myoglobins. The changes in the experimental binding energies from one system to another are well reproduced by the calculations. Without constraints on the residues in geometry optimization, the dispersion correction is necessary, since it improves the calculated structures and energetic results significantly.