Given a field $F$, the ring of polynomials $F[x]$ is a popular example of ED. However, it seems that $F[x]$ does not even have to be a domain.
For example, take $F=\mathbb{F}_2$. Then $$x(x-1)\equiv0$$ since LHS and RHS always have the same output for whatever input $x$. But of course we don't have $x\equiv0$ nor $x-1\equiv0$, which shows that zero divisor exists. How can we explain this?
The polynomial $x^2-x$ is identically $0$ on $F$, but it is not equal to $0$ in $F[x]$. Your issue is confusing equality of functions with equality of polynomials. Remember that two polynomials are equal if and only if all of their coefficients are equal. Whereas, two functions on the same sets are equal if and only if they agree everywhere.