In this article, a finite‐horizon adaptive Pontryagin's maximum principle is presented for nonlinear systems with state inequality constraints. Concurrent learning (CL) technique is adopted to identify the unknown parameters of the dynamic systems. Based on the identification model, a novel adaptive iterative algorithm under the Pontryagin's framework is introduced to learn the finite‐horizon optimal control solution. Convergence analysis of the algorithm is provided by showing that the cost function sequence is monotonically decreasing. Furthermore, we extend the adaptive iterative algorithm to time‐varying nonlinear systems. The new algorithm overcomes the technical obstacles of the existing adaptive/approximate dynamic programming (ADP) approaches to deal with the time‐varying characteristic of Hamilton–Jacobi–Bellman (HJB) partial differential equation (PDE), especially when state constraints exist. Simulation examples are carried out to validate the effectiveness of the theoretical results.