This article considers fractional optimal control problems (FOCPs) including both integer‐order and Atangana–Baleanu Caputo derivatives. First, the existence and uniqueness of the solution of a fractional Cauchy problem is given. Then, applying calculus of variations and Lagrange multiplier method, we present necessary optimality conditions of FOCPs and sufficient optimality conditions are also given under some assumptions. Next, a collection method is developed to derive numerical solutions by using shifted Legendre polynomials. Finally, error estimate of numerical solutions is also provided, and numerical examples further show the accuracy and feasibility of our method.