Infection is one of the major causes of failure of orthopedic implants. Our previous study demonstrated that nanotube modification of the implant surface, together with nanotubes loaded with quaternized chitosan (hydroxypropyltrimethyl ammonium chloride chitosan, HACC), could effectively inhibit bacterial adherence and biofilm formation in vitro. Therefore, the aim of this study was to further investigate the in vitro cytocompatibility with osteogenic cells and the in vivo anti-infection activity of titanium implants with HACC-loaded nanotubes (NT-H). The titanium implant (Ti), nanotubes without polymer loading (NT), and nanotubes loaded with chitosan (NT-C) were fabricated and served as controls. Firstly, we evaluated the cytocompatibility of these specimens with human bone marrow-derived mesenchymal stem cells in vitro. The observation of cell attachment, proliferation, spreading, and viability in vitro showed that NT-H has improved osteogenic activity compared with Ti and NT-C. A prophylaxis rat model with implantation in the femoral medullary cavity and inoculation with methicillin-resistant Staphylococcus aureus was established and evaluated by radiographical, microbiological, and histopathological assessments. Our in vivo study demonstrated that NT-H coatings exhibited significant anti-infection capability compared with the Ti and NT-C groups. In conclusion, HACC-loaded nanotubes fabricated on a titanium substrate show good compatibility with osteogenic cells and enhanced anti-infection ability in vivo, providing a good foundation for clinical application to combat orthopedic implant-associated infections.