Because of unique properties such as the lightweight, natural biodegradability, and biocompatibility, magnesium alloys are promising in biomedical implants. However, inadequate corrosion resistance in the physiological environment remains a technical hurdle and application of coatings is a viable means to overcome the deficiency. Also, the antibacterial properties are very important in order to mitigate post-implantation complications arising from bacterial infection. In this study, a biocompatible silk film is deposited on AZ31 Mg alloy to enhance the corrosion resistance and by means of oxygen plasma etching, nature-inspired nanopatterns are fabricated on the surface of the silk film to improve the inherent antibacterial properties. The biocompatibility and antibacterial properties are determined with MC3T3-E1 osteoblast cells and E. coli and S. aureus, respectively. The antimicrobial properties of the silk coated AZ31 are better than those of the bare alloy probably due to the combined effects of the nanopatterns and alkalinity associated with leaching of Mg ions. The β-sheets formed on the silk film is found to result in 104 times reduction in the corrosion current density and 50% reduction in Mg leaching after 1 day. Although degradation of the β-sheets is observed to begin after 1 day, the amount of Mg ions leached to the medium from silk-coated AZ31 is still 17% lower than that from the bare one. The biomimicking nanopatterns on the natural silk film improve the corrosion resistance, biocompatibility, and antibacterial properties simultaneously and have large clinical potential.