We present an approach for solving optimal boundary control problems of nonlinear optics by using deep learning. For computing high resolution approximations of the solution to the nonlinear wave model, we propose higher order space-time finite element methods in combination with collocation techniques. Thereby, Cl-regularity in time of the global discrete solution is ensured. The simulation data is used to train solution operators that effectively leverage the higher regularity of the data. The solution operator is represented by Fourier Neural Operators and can be used as the forward solver in the optimal Dirichlet boundary control problem.The proposed algorithm is implemented and tested on high-performance computing platforms, with a focus on efficiency and scalability. The effectiveness of the approach is demonstrated on the problem of generating Terahertz radiation in periodically poled Lithium Niobate. The neural network is used as the solver in the optimal control setting to optimize the parametrization of the optical input pulse and maximize the yield of 0.3THz-frequency radiation.We exploit the periodic layering of the crystal to design the neural networks. The networks are trained to learn the propagation through one period of the layers. The recursive application of the network onto itself yields an approximation to the full problem. Our results indicate that the proposed method can achieve a speedup by a factor of 360 compared to classical methods. A comparison of our results to experimental data shows the potential to revolutionize the way we approach optimization problems in nonlinear optics.