Optimal control is developed to guarantee nonlinear systems run in an optimum operating state. However, since the operation demands of systems are dynamically changeable, it is difficult for optimal control to obtain reliable optimal solutions to achieve satisfying operation performance. To overcome this problem, a knowledge-data driven optimal control (KDDOC) for nonlinear systems is designed in this article. First, an adaptive initialization strategy, using the knowledge from historical operation information of nonlinear systems, is employed to dynamically preset parameters of KDDOC. Then, the initial performance of KDDOC can be enhanced for nonlinear systems. Second, a knowledge guide-based global best selection mechanism is used to assist KDDOC in searching for the optimal solutions under different operation demands. Then, dynamic optimal solutions of KDDOC can be obtained to adapt to flexible changes in nonlinear systems. Third, a knowledge direct-based exploitation mechanism is presented to accelerate the solving process of KDDOC. Then, the demand response speed of KDDOC can be improved to ensure nonlinear systems with optimal operation performance in different states. Finally, the performance of KDDOC is validated on a simulation and a practical process. Several experimental results illustrate the effectiveness of the proposed optimal control for nonlinear systems.