In any ring, invertible elements (units) cannot be zero divisors; for let $a$ be invertible in the ring $R$; then we have $b \in R$ such that $ab = ba = 1$. If $a$ is a zero divisor, then we have either $ac = 0$ or $ca = 0$ for some $0 \ne c \in R$. But $ac = 0$ implies
$c = 1c = (ba)c = b(ac) =0, \tag{1}$
likewise, $ca = 0$ also implies $c = 0$; these contradictions rule out the possibility that $a$ is a zero divisor.
To see that non-zero divisors are invertible for $a \in A$, an algebra of finite dimension over some field $\Bbb F$, recall that for such $a$ the sequence $1, a, a^2, \ldots, a^i, \ldots$ must exhibit a linear dependence since $\dim A < \infty$. Thus for some smallest $n$ there is a set of $ f_i \in \Bbb F$, $0 \le i \le n$, not all $f_i$ zero, with
$\sum_0^n f_i a^i = 0; \tag{2}$
here we have $f_n \ne 0$, by virtue of the minimality of $n$; note we may also assume $n \ge 2$, since otherwise (2) asserts that $a \in \Bbb F$ and the question trivializes. Given a relation as (2) amongst the powers of $a$, we may write
$\sum_1^n f_i a^i = -f_0 \tag{3}$
or
$a\sum_1^n f_i a^{i -1}= - f_0. \tag{4}$
We note that we cannot have
$\sum_1^n f_i a^{i - 1} = 0 \tag{5}$
by the minimality of $n$; thus we cannot have $f_0 = 0$, for then (4) becomes
$a\sum_1^n f_i a^{i - 1} = 0, \tag{6}$
affirming that $a$ is a zero-divisor. But with $0 \ne f_0 \in \Bbb F$ we may write (4) in the form
$a (\sum_1^n (-f_0^{-1})f_i a^{i - 1}) = (\sum_1^n (-f_0^{-1})f_i a^{i - 1}) a = 1, \tag{7}$
showing that $a^{-1}$ is in fact given by the polynomial expression
$a^{-1} = \sum_0^{n-1} (-f_0^{-1})f_{i+1} a^i; \tag{8}$
thus non-zero divisors in algebras $A$ of finite dimension over their fields $\Bbb F$ are invertible. QED.