Example of factorization in a polynomial ring which is not an UFD
When $A$ is not a domain, decomposing a polynomial in $A[x]$ as $f=gh$ does not necessarily simplify it, that is, does not always reduce its degree.
For instance: $$ 5x+1=(2x+1)(3x+1) \bmod 6 $$
It is even possible to decompose a linear polynomial as a product of two quadratic polynomials: $$ x+1=(2x^2+x+7)(4x^2+6x+7) \bmod 8 $$
Perhaps this is the sort of thing you are looking for: If $a,b,c,d\in A$ are irreducible non-associate elements such that $ab=cd$, then $$ (ax+c)(dx-b) = adx^2 - bc = (ax-c)(dx+b). $$ With $A = \mathbb{Z}[\sqrt{-5}]$, taking $(a,b,c,d) = (2,3,1+\sqrt{-5},1-\sqrt{-5})$, this results in $$ (2x+1+\sqrt{-5})((1-\sqrt{-5})x-3) = (2x-1-\sqrt{-5})((1-\sqrt{-5})x+3). $$ However, you might still see this a kind of cheat, since $ax+c$ and $dx+b$ actually are scalar multiples; it's just that the scalar factor, $d/a = b/c$, isn't in $A$ but is instead in its field of fractions. But this is unavoidable: over the field of fractions, polynomials do have unique factorization; so seemingly distinct factorizations into linear factors over $A$ necessarily become identical aside from units over the field of fractions.
Another possibility is to use a higher-order polynomial that is irreducible over $A$, but not over the field of fractions. For example, if $ab=cd$ then $$ (ax+c)(ax+d) = a(ax^2 + (c+d)x + b). $$ In $\mathbb{Z}[\sqrt{-5}]$, this might be realized as $$ (2x + 1 + \sqrt{-5})(2x + 1 - \sqrt{-5}) = 2(2x^2 +2x + 3). $$ This is, in essence, an example of the failure of Gauss's lemma for a non-UFD. I found the idea for this example in David E Speyer's answer to a MathOverflow question; the other responses may also be of interest.