Clinically, it is difficult to endow implants with excellent osteogenic ability and antibacterial activity simultaneously. Herein, the self-activating implants modified with hydroxyapatite (HA)/MoS<sub>2</sub> coating are designed to prevent *Staphylococcus aureus* (*S. aureus*) and *Escherichia coli* (*E. coli*) infections and accelerate bone regeneration simultaneously. The electron transfer between bacteria and HA/MoS<sub>2</sub> is triggered when bacteria contacted with the material. RNA sequencing data reveals that the expression level of anaerobic respiration-related genes is up-regulated and the expression level of aerobic respiration-related genes is down-regulated when bacteria adhere to the implants. HA/MoS<sub>2</sub> presents a highly effective antibacterial efficacy against both *S. aureus* and *E. coli* because of bacterial respiration-activated metabolic pathway changes. Meanwhile, this coating promotes the osteoblastic differentiation of mesenchymal stem cells by altering the potentials of cell membrane and mitochondrial membrane. The proposed strategy exhibits great potential to endow implants with self-activating anti-infection performance and osteogenic ability simultaneously.