Mg-substituted ZnO nanoparticles (MgZnO NPs) were synthesized by a soft chemical approach and were well-characterized by X-ray diffraction, transmission electron microscopy, UV-visible spectroscopy, and photoluminescence spectroscopy. The absorption and photoluminescence spectra show that substitution of Mg ions results in the widening of the band gap and a significant enhancement in the concentration of defects in ZnO NPs. A systemic study of generation of reactive oxygen species (ROS) under dark, daylight, and visible light conditions suggests that the aqueous suspension of MgZnO NPs generates a higher level of ROS because of the surface defects (oxygen vacancies). This capability of MgZnO NPs makes them a more promising candidate for the inhibition of bacterial growth and for killing of cancer cells as compared to pure ZnO NPs, possibly because of the enhanced interaction and accumulation of MgZnO NPs in the cytoplasm or cell membrane in the presence of both Zn2+ and Mg2+ ions. Further, MgZnO NPs exhibit excellent selective killing of nasopharyngeal carcinoma cells (KB) and cervical cancer cells (HeLa) with minimal toxicity to normal fibroblast cells (L929). The results suggest that the generation of ROS and Zn2+ ions are possibly responsible for the higher activity toward the depolarization of cell membrane potential, the lipid peroxidation in bacterial cells, depolarization of the mitochondrial membrane, and cell cycle arrest in the S phase in cancer cells.