To improve the corrosion resistance and antibacterial adhesion properties of AZ31 magnesium alloy as an orthopedic implant material, superhydrophobic hydroxyapatite/lauric acid composite coatings (HA/LA) were successfully fabricated on AZ31 magnesium alloy utilizing the hydrothermal method and followed by immersion treatment in lauric acid solution. The underlying HA coating synthesized by hydrothermal technique presents a micro-/nanohierarchical structure, appearing superhydrophilic, while the composite coatings (HA/LA) obtained by subsequent treatment with lauric acid exhibited excellent superhydrophobic properties with a contact angle of 152.5 ± 1.2° and a rolling angle of 1.5 ± 0.3°. Electrochemical measurements and long-term corrosion resistance test conducted in simulated body fluid (SBF) indicate a significant enhancement in the corrosion resistance of the HA/LA composite coating. Meanwhile, in vitro bacterial experiments demonstrated that the superhydrophobic composite coating surface was able to reduce the adhesion of adherent Escherichia coli and Staphylococcus aureus by more than 98%, showing excellent antibacterial adhesion properties, indicating that the superhydrophobic HA/LA composite coating in this work grants magnesium alloy with excellent corrosion resistance and antibacterial properties.