Lysozymes are antimicrobial acid hydrolases widely distributed in nature. They are located inside the cells in lysosomes, or they are secreted to the extracellular space, where they can lyse the cell wall of certain species of bacteria via hydrolysis of the peptidoglycan. Thus, lysozymes are bacteriolytic enzymes and play a major biological role in biodefense, as these enzymes can act as antibacterial and immune-modulating agents. In this study, we characterized a g-type lysozyme from the scallop Argopecten purpuratus named ApGlys. The cDNA sequence comprises an open reading frame (ORF) of 600 nucleotides, codifying for a putative protein of 200 amino acids with a signal peptide of 18 amino acids. The deduced mature protein sequence displays a molecular weight of 20.07 kDa and an isoelectric point (pI) of 6.49. ApGlys deduced protein sequence exhibits conserved residues associated with catalytic activity and substrate fixation in other g-type lysozymes. The phylogenetic analysis revealed a high degree of identity of ApGlys with other mollusk g-type lysozymes, which form a restricted and separated clade from the vertebrate lysozymes. ApGlys transcripts were constitutively and highly expressed in the digestive gland, and it was induced in hemocytes and gills of scallops after an immune challenge. Furthermore, the ApGlys protein was located inside hemocytes of immunostimulated scallops, determined by immunofluorescence analysis. Finally, the transcript silencing of ApGlys by RNA interference led to an increase of total culturable bacteria from the scallop hemolymph. Furthermore, we detected a higher diversity of the bacterial community in ApGlys-silenced scallops and an imbalance of certain bacterial groups present in the hemolymph by 16S rDNA deep amplicon sequencing. Overall, our results showed that ApGlys is a new member of scallop lysozymes that is implicated in the immune response and in the microbial homeostasis of A. purpuratus hemolymph.