We consider general self-adjoint polynomials in several independent random matrices whose entries are centered and have the same variance. We show that under certain conditions the local law holds up to the optimal scale, i.e., the eigenvalue density on scales just above the eigenvalue spacing follows the global density of states which is determined by free probability theory. We prove that these conditions hold for general homogeneous polynomials of degree two and for symmetrized products of independent matrices with i.i.d. entries, thus establishing the optimal bulk local law for these classes of ensembles. In particular, we generalize a similar result of Anderson for anticommutator. For more general polynomials our conditions are effectively checkable numerically.