In this paper we study vakonomic dynamics on contact systems with nonlinear constraints. In order to obtain the dynamics, we consider a space of admisible paths, which are the ones tangent to a given submanifold. Then, we find the critical points of the Herglotz action on this space of paths. This dynamics can be also obtained through an extended Lagrangian, including Lagrange multiplier terms.This theory has important applications in optimal control theory for Herglotz control problems, in which the cost function is given implicitly, through an ODE, instead of by a definite integral. Indeed, these control problems can be considered as particular cases of vakonomic contact systems, and we can use the Lagrangian theory of contact systems in order to understand their symmetries and dynamics.