How are anomalies possible? From Matthew D. Shwartz Quantum Field Theory textbook, he writes:

"Most of the time, a symmetry of a classical theory is also a symmetry of the quantum theory based on the same Lagrangian. When it is not, the symmetry is said to be anomalous."

A priori, how is this even possible? If a symmetry is present in a classical Lagrangian, and the quantum theory is based on the same Lagrangian, and the Lagrangian completely specifies the dynamics, then wouldn't the symmetry being present in the Lagrangian necessitate the symmetry is in the quantum theory?
 A: This is such a short answer I'm tempted to just leave it as a comment, but besides specifying the Lagrangian you need to also specify your regularization, and the regularization is what introduces the anomaly. You can think of this regularization as specifying the measure of the path integral, and the Fujikawa perspective on anomalies is that the Lagrangian is invariant under the symmetry but the path integral measure is not.
A: The reason for this is that in the classical theory the Lagrangian fully specifies the dynamics of the system, however, in the Quantum system this is not true. Rather the Quantum theory is given by (in the path integral formulation) by the partition function $Z = \int D F e^{iS[F]}$ (with appropriate boundary condition. Now the idea is that even though you know that the action is invariant under a transformation the path integral measure $D F$ does not necessarily have to be. This can essentially break your symmetry fro the quantum theory.
A: It's true as the others have said that the path integral measure may not be invariant.
However I don't really like that quote as a general description of anomalies, since it sounds like they rely on a Lagrangian or a classical limit, and there are theories without any classical counterpart for which we can still discuss their anomalies.
There are even symmetries which you can't see in the action, which don't act on the fields, but only on solitonic objects like magnetic monopoles.
Meanwhile, some anomalies, such as those involving the theta angle, are perfectly apparent at the level of the classical action and one doesn't need to think about the measure.
In modern times we realize that 't Hooft anomalies are a part of the very definition of the symmetry in a quantum system. We understand them by the behavior of topological defects associated with the symmetries, or by special contact terms in the Ward identities.
