If your monoid is given by a finite automaton, you cannot hope in general for a very efficient algorithm, since it is proved in [1] that aperiodicity is $\text{PSPACE}$-complete.
On the other hand, one can test in $O(|A||M|)$-time whether an $A$-generated finite monoid $M$ is aperiodic. For this, you can first compute the right and left Cayley graph of the monoid: the vertices of these graphs are the elements of $M$ and for each $m \in M$ and each generator $a \in A$, there is an edge $m \xrightarrow{a} ma$ for the right Cayley and $m \xrightarrow{a} am$ for the left Cayley graph. The strongly connected components of the right [left] Cayley graph give you the $\mathcal{R}$-classes [$\mathcal{L}$-classes] of $M$. Intersecting
$\mathcal{R}$-classes and $\mathcal{L}$-classes give you the $\mathcal{H}$-classes and it suffices to check that all of them are trivial.
Moreover, there are a few things that can help you. For instance, a finite monoid is aperiodic if and only if its regular $\mathcal{H}$-classes are trivial (so you don't have to care about nonregular elements).
If you already have the multiplication table and want to use brute force, you can iteratively compute $x, x^2, x^4, x^{2^k}$ until $2^k \geqslant |M|$ ($\log(M)$ steps) and then check whether $x^{2^k} = x^{2^k}x$. Not very efficient, but it will work.
[1] S. Cho, D. T. Huynh, Finite-automaton aperiodicity is PSPACE-complete, Theoretical Computer Science 88 (1991) 99–116