The biosynthesized magnesium oxide nanoparticles were pigeon-holed with X-ray diffraction (XRD), ultraviolet-visible (UV-Vis) spectrophotometer, scanning electron microscope (SEM), and photoluminescence spectrometer (PLs) and antibacterial activity. Datura stramonium leaves extract has been used in the present work,; which has medicinal value, and we have synthesized magnesium oxide nanoparticles from both chemical and biosynthesis techniques. The XRD result indicates the realization of crystalline magnesium oxide nanoparticles, and again it is also inveterated with an ultraviolet-visible (UV-Vis) spectrophotometer. The superficial morphology expresses that magnesium oxide nanoparticles have a bulbous morphological shape for both biosynthesis and chemosynthesis. The antibacterial activity of magnesium oxide nanoparticles obtained from Datura stramonium leaves against E. coli and S. aureus was studied. The antibacterial activity also shows a good zone of inhibition. Both techniques are promising for the preparations of MgO nanoparticles in antibacterial activity and show the same result. This outcome demonstrates that the biosynthesized nanoparticles originate from having some medicinal uses and are biodegradable.