For ease of writing, I'll say a compact connected Lie group $G$ has the Krull–Schmidt property if, up to order, it has a unique decomposition as a direct product where each factor itself cannot be decomposed any further.
One relatively nice sufficient condition for $G$ to have the Krull–Schmidt property given as follows.
Proposition: Suppose $G$ is a compact connected Lie group and that the center of $G$ is at most one dimensional. Then $G$ has the Krull–Schmidt property.
Sketch: The group $G$ has a cover of the form $G_0\times G_1\times \dotsb \times G_n$ where $G_0 = (S^1)^a$, $a\in \{0,1\}$ and every other $G_i$ is non-abelian and simple (in the sense that any proper normal subgroup is finite). Call the covering map $\pi$.
If $N\trianglelefteq G$ is a closed normal subgroup, then it is easy to see that $N$ is of the form $\pi(N_0\times N_1\times \dotsb \times N_n)$ where $N_0 = \{1\}$ or $(S^1)^a$, and each $N_i$ is either trivial or equal to $G_i$. (See, e.g., this MSE question. This doesn't use the fact that $a\leq 1$.)
Now, suppose we have a decomposition $G = K_1\times \dotsb\times K_k$ with each $K_i$ indecomposable. As each factor is normal, it follows from the previous paragraph that each $\pi(G_i)$ is contained in some $K_j$. (Note that if $a > 1$, in general $\pi(G_0)$ need not be contained in a single $K_j$.)
Since each $K_i$ intersects $K_j$ only in the identity, it follows that if $\pi(G_i)$ and $\pi(G_j)$ intersect non-trivially (i.e., in more than just the identity), they must like in the same $K_\ell$ factor.
Now, create an equivalence relation on $\{G_0,\dotsc, G_n\}$ as the transitive closure of the symmetric, reflexive relation where $G_i\sim G_j$ if $\pi(G_i)\cap\pi(G_j)$ contains more than the identity. This equivalence relation, of course, partitions $\{G_0,\dotsc, G_n\}$. For any set in the partition, all the $G_i$ in that set must be contained in the same $K_j$. If some $K_j$ contains elements from two different sets in the partition, then that $K_j$ can be decomposed further, giving a contradiction.
Thus, we find that the unique decomposition $G= K_1\times \dotsb\times K_k$ with each $K_i$ indecomposable is obtained from the above partition. Since the partition is uniqueley defined by the group, $G$ must have the Krull–Schmidt property $\square$.
On the other hand, if you allow $G$ to have a center of dimension $2$, it may fail to have the Krull–Schmidt property.
$\DeclareMathOperator\SU{SU}$Proposition: Suppose $\mu$ denotes a fixed non-trivial $3$rd root of unity. Then the group $G:= (S^1\times S^1\times \SU(2)\times \SU(3))/ \langle (1,-1,-I_2,I_3), (1,\mu, I_2, \mu I_3)\rangle$, where $I_k$ denotes the $k\times k$ identity mtarix, does not have the Krull–Schmidt property.
Sketch: Note that the first $S^1$ factor does not participate in the quotienting. As such, $G$ naturally has a decomposition as $G = S^1 \times (S^1\times \SU(2)\times \SU(3)/ \langle (-1,-I_2,I_3), (\mu, I_2, \mu I_3)\rangle)$. Regardless of whether the second factor further decomposes (it doesn't) it's obvious that this decomposition has an $S^1$ factor. We will now find another decomposition of $G$ which has no $S^1$ factor.
To that end, we consider the subgroups $U,V\subseteq S^1\times S^1$ where $$U = \{(u^2,u):u\in S^1\} \text{ and } V = \{(v^3,v):v\in S^1\}.$$
It is easy to verify that $U\cap V = \{(1,1)\}$ and that $U\cdot V = S^1\times S^1$. That is, every $(z,zw)\in S^1\times S^1$ has a unique representation in the form $uv$ with $u\in U$ and $v\in V$.
So, we can replace the $S^1\times S^1$ factor with $U\times V$. The old point $(1,-1) \in S^1\times S^1$ has the form $(-1,1)$ in $U\times V$ and the old point $(1,\mu)\in S^1\times S^1$ has the form $(1,\mu)\in U\times V$.
Thus, we see $$G \cong (U\times V\times \SU(2)\times \SU(3))/ \langle (-1,1,-I_2,I_3), (1,-\mu, I_2, \mu I_3)\rangle.$$ In this new description, the point $(-1,1,-I_2, I_3)$ only affects $U\times \{1\}\times \SU(2) \times \{I_3\}$, and has quotient $U(2)$, while the point $(1,-\mu, I_2, \mu I_3)$ only affects $\{1\}\times V\times \{I_2\}\times \SU(3)$, and has quotient $U(3)$. Thus, we have shown that $G \cong U(2)\times U(3)$.
To complete the proof, we need only note that neither $U(2)$ and $U(3)$ can split off an $S^1$ in a decomposition. It is easy to convince yourself the only possible decompositions look like $S^1\times H$ where $H$ is finitely covered by $\SU(2)$ or $\SU(3)$. But if $H$ is simply connected, then $Z(S^1\times H)\cong S^1\times \mathbb{Z}/k\mathbb{Z}$ is not isomorphic to $Z(U(k))\cong S^1$ (for $k=2,3$) since the former group has too many elements of order $k$. If $H$ is not simply connected, then $\pi_1(U(k))\cong\mathbb{Z}$ is not isomorphic to $\pi_1(S^1\times H) \cong \mathbb{Z}\times \mathbb{Z}/k\mathbb{Z}$. $\square$