Lysozyme is used as a food preservative, biological medicine, and infant food additive as a natural anti-infective chemical having bactericidal activity and abundantly secreted in mammals' milk, saliva, etc. We systematically analyzed the 16 coding LYZ genes (C and G-type) in buffalo and cattle to elucidate their evolutionary perspective thoroughly by evaluating an evolutionary relationship, motif patterning, physicochemical attributes, gene, and protein structure, as well as the functional role of the mammary gland-specific expressed buffalo and cattle LYZ genes precisely while considering expression levels difference and the interaction sites variation with bacteria envisaged the potential ability of buffalo LYZ protein with enhanced antibacterial effect. Thus, we speculated that the buffalo mammary glands expressed lysozyme has good antibacterial activity. This study on the buffalo lysozyme gene family not only provides comprehensive insights into the genetic architecture and their antibacterial effect but also offers a theoretical basis for the development of new veterinary drugs and animal health care for mastitis, as well as a new molecular genetic basis to study food or medical lysozyme.