The invention belongs to the field of product extraction technology and relates to a method for extracting chitin and antibacterial peptide from fly larvae. The method comprises the following steps of: firstly disinfecting and rinsing fresh fly larvae to be clean, then extruding the cleaned fly larvae to separate the fly larvae skin from visceral mass serous fluid; firstly soaking with hydrochloric acid solution, drying after washing, and then soaking with NaOH solution to remove protein; retaining residual liquid, drying after cleaning, adding the NaOH solution after crushing, carrying out water bath at the temperature of 98 DEG C, and heating for reaction; putting chitosan into acetic acid solution, stopping reaction after the chitosan is dissolved, filtering, cleaning, drying at the temperature of 50 DEG C, and obtaining the chitosan; and then adding acetic acid into the visceral mass serous fluid of the fly larvae, homogenizing, standing over the night at the temperature of 4 DEG C, filtering, adsorbing the filtrate with alginic acid, filtering, then eluting the antibacterial peptide adsorbed on the alginic acid with the hydrochloric acid solution, adjusting the pH value of the eluent to be 3.5, carrying out precipitation with NaCl, carrying out dialysis and desalting, drying and obtaining a crude antibacterial peptide product. The method has the advantages of reasonable technical route, low cost, high yield, large economic value, environmentally-friendly effect and effective utilization of the fly larvae resources for preparing natural product varieties.