The general notion of minimal polynomial, as Roy Smith indicated in the comments, works whenever you have an algebra $A$ over a field $K$ and an element $a\in A.$ Namely, consider the unique algebra homomorphism $\pi:k[t]\to A$ that sends $a$ to $t.$* Since $k[t]$ is a principal ideal domain, its kernel $\ker\pi$ is $(P),$ where $P$ may be chosen to be a monic polynomial of degree $d\geq 0$, or 0. In the former case, $f$ is the minimal polynomial of $a$ and in the latter case, $a$ generates a polynomial algebra inside $A.$ The canonical object which perhaps deserves the name "minimal polynomial" is the ideal $(P)$. When $A$ is a general commutative ring, same reasoning leads to the ideal $\ker\pi$, but there is no reason to expect that it is principal.
(*) The idea of "prolonging" the element $a$ to the homomorphism $\pi$ is an algebraic version of the "functional calculus". Thus expressions $q(a)$ for various polynomials $q\in K[t]$ make sense: they are simply $\pi(q).$ However, the functional calculus used in analysis and operator algebra theory involves much larger functional spaces than just polynomials.
Another useful interpretation of the minimal polynomial is through the poles of the formal resolvent of $a.$ For any commutative ring $A$ (not necessarily an algebra over a field), consider
$$
(\lambda-a)^{-1}=\sum_{n=0}^{\infty}\lambda^{-n-1}a^n \in A((\lambda^{-1})).
$$
A priori, this is just a Laurent formal power series in $\lambda^{-1}$; however,
When $a$ has a minimal polynomial $P(t)$, it is in fact a rational function of $\lambda$ with the denominator (in lowest terms) $P(\lambda),$ and conversely.
Indeed,
$P(a)(\lambda-a)^{-1}=P(\lambda)(\lambda-a)^{-1}$ modulo polynomials in $\lambda.{\ } \square$
See my answer
How would you solve this tantalizing Halmos problem?
for related ideas.