Photonic crystals are periodic structures with refractive index changes in one, two, or three dimensions. Due to their unique design, these crystals exhibit a photonic band gap that allows light to propagate through the structure at specific frequencies and be reflected at other frequencies. In regions where light cannot pass, known as the forbidden band gap, certain photonic states are created by deliberately creating defects in the crystal. These are called defect modes. By analyzing the dispersion curve of the defect mode, valuable information can be obtained about the behavior of light within the structure. This information includes the group velocity of the light, group velocity dispersion, and sensor sensitivity.This study proposes a two-dimensional square lattice symmetry photonic crystal design. This design arranges dielectric rods on a low refractive index material according to the square lattice symmetry. The dispersion curve of the defect mode obtained through the created line defect in the structure is investigated, and the change in group velocity of the propagating light within the structure is obtained. Increasing the sensor sensitivity is achieved by reducing the group velocity of the propagating light. Classification-based machine learning methods are employed to detect chemical substances, and the performance rates of these methods are compared for chemical substance detection.