In this paper we have introduced a new class of problems of optimal control theory with differential inclusions described by polynomial linear differential operators. Consequently, there arises a rather complicated problem with simultaneous determination of the polynomial linear differential operators with variable coefficients and a Mayer functional depending on high order derivatives. The sufficient conditions, containing both the Euler-Lagrange and Hamiltonian type inclusions and transversality conditions are derived. Formulation of the transversality conditions at the endpoints of the considered time interval plays a substantial role in the next investigations without which it is hardly ever possible to get any optimality conditions. The main idea of the proof of optimality conditions of Mayer problem for differential inclusions with polynomial linear differential operators is the use of locally-adjoint mappings. The method is demonstrated in detail as an example for the semilinear optimal control problem and the Weierstrass-Pontryagin maximum principle is obtained. Then the optimality conditions are derived for second order convex differential inclusions with convex endpoint constraints.