Metal-ion doping is one of the most efficient approaches to precisely control the electronic and optical properties of perovskite nanocrystals (NCs). However, the origin of the dramatic contrast in the photoluminescence (PL) behavior of CsPbBr3 NCs incorporating bismuth (Bi3+) and cerium (Ce3+) ion dopants remains unclear. Here, we demonstrate dominant PL quenching/enhancing centers both in the bulk and on the surface of Bi3+/Ce3+-doped CsPbBr3 by calculating the dopant defect formation energies and charge-transition levels using high-level density functional theory (DFT). We show that the Bi3+ dopants introduce deep trap states (antisite BiPb and interstitial Bii) that are responsible for PL quenching. In sharp contrast, the Ce3+ dopants enhance the CsPbBr3 lattice order and enrich the conduction band-edge states through antisite CePb, causing PL enhancement. Our findings not only provide new physical insights into the mechanism of the trivalent metal-ion doping effect but also suggest a new strategy to control the dopant defect states for improving the optical performance of perovskite NCs.