Following up on comments:
Given sets $X$ and $Y$, if $\kappa=|X|$ and $\lambda=|Y|$, then we have a well-defined cardinality (or cardinal) $\kappa+\lambda=|(X\times\{0\})\cup (Y\times\{1\})|$. (The $0$ and $1$ factors are present to force the sets to be disjoint, which is important when dealing with finite cardinals.) This gives a well-defined notion of addition of cardinals, which extends the standard definition of addition for finite nonnegative integers.
On the other hand, there is no general notion of "subtraction" for cardinals. For example if I have a set $X$ of cardinality $\aleph_0$, and a subset $Y$ also of cardinality $\aleph_0$, then $X\setminus Y$ could have any cardinality from $0$ to $\aleph_0$. So $\aleph_0-\aleph_0$ has no well-defined value. This is similar to how $\infty-\infty$ is an indeterminate when doing limits.
So this is probably the reason why Wolfram Alpha returns "undefined" when you enter a subtraction involving non-finite cardinals. However, as Wojowu says, there are some cases where subtraction does make sense. For example, if $\kappa$ is infinite ($\aleph_0$ for example) and $n$ is finite, then there is a unique cardinal that "solves" the equation $n+x=\kappa$, namely $\kappa$ itself. So one could reasonably say $\kappa-n=\kappa$. For a general discussion, see: Cardinal number subtraction