In this study, O-quaternary ammonium chitosan (O-HTCC) containing bicationic antibacterial active groups was synthesized to develop an O-HTCC/PVA porous nanofibrous film to enhance antibacterial activity, leveraging surface modification and nano-porous structure design. Uniform and smooth nanofibrous structures (average diameter: 72–294 nm) were successfully obtained using a simple and feasible electrospinning method. A response surface model via Box-Behnken design (BBD) was used to clarify the interaction relationship between O-HTCC fiber diameter and three critical electrospinning parameters (O-HTCC concentration, applied voltage, feed flow rate), predicting that the minimum O-HTCC fiber diameter (174 nm) could be achieved with 7 wt% of O-HTCC concentration, 14 kV of voltage, and 0.11 mL/h of feed flow rate. Linear regression (R2 = 0.9736, Radj2 = 0.9716) and the Anderson Darling test demonstrated the excellent fit of the RSM-BBD model. Compared to N-HTCC/PVA nanofibrous film, the O-HTCC/PVA version showed increased growth inhibition and more effective antibacterial efficacies against Escherichia coli (E. coli) (~;86.34 %) and Staphylococcus aureus (S. aureus) (~;99.99 %). DSC revealed improved thermal stability with an increased melting temperature (238 °C) and endothermic enthalpy (157.7 J/g). This study holds potential for further development of antibacterial packaging to extend food shelf-life to reduce bacterial infection.