Traditional finite element analysis methods have the problem of expensive and unstable band structure diagram calculation when generating phononic crystals. Therefore, this study combines back propagation neural networks with ocean predator algorithms to optimize the geometric structure of phononic crystals. The results show that the coefficient of determination for the predicted bandgap width and lower bound of Model 3 is 1.00, which is better than the comparison model. However, Models 2 and 5 have poor predictive performance for bandgap width due to overfitting during actual training. Therefore, after using the ocean predator algorithm for hyperparameter adjustment, it is found that the maximum number of failures in the validation set of Model 5 is 30, the number of hidden layer nodes is 30, and after 500 experiments, the average error of the bandgap width is 5.26%, and the average error of the lower bound of the bandgap is 1.33%. The average error of the bandgap width after hyperparameter adjustment is 4.89%, and the average error of the lower bound of the bandgap is 1.21%, both of which are effectively reduced and better than the comparison model. Overall, the combination model has high computational efficiency and stability in phononic crystal optimization and can be practically applied in the design and optimization of phononic crystal geometric structures.