The misuse and mismanagement of antibiotics have made the treatment of bacterial infections a challenge. This challenge is magnified when bacteria form biofilms, which can increase bacterial resistance up to 1000 times. It is desirable to develop anti-infective materials with antibacterial activity and no resistance to drugs. With the rapid development of nanotechnology, anti-infective strategies based on metal and metal oxide nanomaterials have been widely used in antibacterial and antibiofilm treatments. Here, this review expounds on the state-of-the-art applications of metal and metal oxide nanomaterials in bacterial infective diseases. A specific attention is given to the antibacterial mechanisms of metal and metal oxide nanomaterials, including disrupting cell membranes, damaging proteins, and nucleic acid. Moreover, a practical antibiofilm mechanism employing these metal and metal oxide nanomaterials is also introduced based on the composition of biofilm, including extracellular polymeric substance, quorum sensing, and bacteria. Finally, current challenges and future perspectives of metal and metal oxide nanomaterials in the anti-infective field are presented to facilitate their development and use.