Although poorly understood, cation-exchange reactions are increasingly used to dope or transform colloidal semiconductor nanocrystals (quantum dots). We used density-functional theory and kinetic Monte Carlo simulations to develop a microscopic theory that explains structural, optical, and electronic changes observed experimentally in Ag-cation-exchanged CdSe nanocrystals. We find that Coulomb interactions, both between ionized impurities and with the polarized nanocrystal surface, play a key role in cation exchange. Our theory also resolves several experimental puzzles related to photoluminescence and electrical behavior in CdSe nanocrystals doped with Ag.