Because children are easily influenced and because you would say something bad about your ex, they will begin to harbor those feelings as well. It's almost like unintentional (sometimes intentional) brainwashing.

Additionally, while the things your ex did may affect your kids its something that happened between the two of you. If they don't need to be further exposed to it, they shouldn't. Let them be kids