We have considered the problem of the evolution of two-dimensional few-cycle optical pulses inside a photonic crystal, which has a spatially modeled refractive index, from oriented carbon nanotubes. Based on Maxwell's equations, using the Coulomb calibration, an effective equation for the vector potential of the electric field of an extremely short pulse was written. Numerical simulation of the pulse dynamics in a medium with a spatially variable refractive index was carried out using a numerical scheme of the "cross" type. It was shown that the pulse propagation is stable in the considered medium. The pulse energy remains localized in a limited region of space, but dispersive spreading of the pulse shape takes place. The dynamics of the pulse was also considered as a function of the parameters of the photonic crystal (modulation depth and period of the refractive index); it showed that it is possible to control the speed of a group packet of a few-cycle optical pulse. The calculations were carried out at times up to 10 ps, which plays an important role in theoretical and applied research.