This paper studies two-dimensional variable-order fractional optimal control problems (2D-VFOCPs) having dynamic constraints contain partial differential equations such as the convection–diffusion, diffusion-wave, and Burgers' equations. The variable-order time fractional derivative is described in the Caputo sense. To overcome computational difficulties, a novel numerical method based on transcendental Bernstein series (TBS) is proposed. In fact, we generalize the Bernstein polynomials to the larger class of functions which can provide more accurate approximate solutions. In this paper, we introduce the TBS and their properties, and subsequently, the privileges and effectiveness of these functions are demonstrated. Furthermore, we describe the approximation procedure which shows for solving 2D-VFOCPs how the needed basis functions can be determined. To do this, first we derive a number of new operational matrices of TBS. Second, the state and control functions are expanded in terms of the TBS with unknown free coefficients and control parameters. Then, based on these operational matrices and the Lagrange multipliers method, an optimization method is presented to an approximate solution of the state and control functions. Additionally, the convergence of the proposed method is analyzed. The results for several illustrative examples show that the proposed method is efficient and accurate.