Modern laboratory medicine relies on analytical instruments for bacterial detection, focusing on biosensors and optical sensors for early disease diagnosis and treatment. Thus, Density Functional Theory (DFT) was utilized to study the reactivity of glycine interacted with metal oxides (ZnO, MgO, and CaO) for bacterial detection. Total dipole moment (TDM), frontier molecular orbitals (FMOs), FTIR spectroscopic data, electronic transition states, chemical reactivity descriptors, nonlinear optical (NLO) characteristics, and molecular electrostatic potential (MESP) were all investigated at the B3LYP/6–31G(d, p) level using DFT and Time-Dependent DFT (TD-DFT). The Coulomb-attenuating approach (CAM-B3LYP) was utilized to obtain theoretical electronic absorption spectra with the 6-31G(d, p) basis set to be more accurate than alternative quantum chemical calculation approaches, showing good agreement with the experimental data. The TDM and FMO investigation showed that glycine/CaO model has the highest TDM (10.129Debye) and lowest band gap (1.643 eV). The DFT computed IR and the experimental FTIR are consistent. The calculated UV-vis spectra showed a red shift with an increase in polarity following an increase in the absorption wavelength due to the interaction with ZnO, MgO, and CaO. Among the five solvents of water, methanol, ethanol, DMSO and acetone, the water and DMSO enhances the UV-Vis absorption. Glycine/CaO model showed high linear polarizability (14.629 × 10−24esu) and first hyperpolarizability (23.117 × 10−30esu), indicating its potential for nonlinear optical applications. The results showed that all model molecules, particularly glycine/CaO, contribute significantly to the development of materials with potential NLO features for sensor and optoelectronic applications. Additionally, MESP confirmed the increased electronegativity of the studied structures. Additionally, glycine/ZnO nanocomposite was synthesized and characterized using IR and UV-visible spectroscopy to determine their structural and spectroscopic features. It was discovered that there was good agreement between the DFT computed findings and the related experimental data. The antibacterial activity of glycine/ZnO nanocomposites against Staphylococcus aureus (S. aureus) and Pseudomonas aeruginosa were studied in terms of concentration and time. The results showed that increasing the concentration of glycine/ZnO nanocomposite significantly enhanced its antibacterial efficacy by lowering optical density. Notably, Pseudomonas aeruginosa exhibited lower susceptibility to the nanocomposite compared to S. aureus, requiring higher concentrations for effective bactericidal action. In summary, this study contributes novel insights into the dual functionality of glycine-metal oxide complexes, with significant implications as optical biosensor for microbial detection.