Actually, the inequality for the Hausdorff dimension of product sets goes the other way
(fixed in the OP now):
$$
\dim_{X\times Y}(U_1\times U_2) \ge \dim_X(U_1)+\dim_Y(U_2).
$$
And you probably need to assume something about the metric space, locally compact should do. This inequality is a consequence of Frostman's Lemma (for compact metric spaces it is due to Howroyd), which says that $\dim_X(U)$ is the supremum of all $s$ such that there exists a Borel probability measure on $U$ satisfying $\mu(B(x,r)) \le C\, r^s$.
If $\mu_1,\mu_2$ are such measures for $U_1, U_2$ with exponents $s_1, s_2$, then $\mu_1\times\mu_2$ is a measure on $U_1\times U_2$ satisfying
$$
\mu_1\times \mu_2(B(x,r)) \le C\, r^{s_1+s_2},
$$
giving the inequality above.
Indeed there are examples of sets $U_1$ of Hausdorff dimension $0$ in $\mathbb{R}$ (for example) such that $\dim(U_1\times U_1)=1$.
However, there is a very natural condition under which equality holds: this will happen whenever either $U_1$ or $U_2$ have equal Hausdorff and packing dimension. Packing dimension is much less well known than Hausdorff dimension, however in my opinion this shouldn't be the case as it plays a dual role (it is defined in terms of packings rather than coverings) and, as this question illustrates, it is often necessary even if you only care about Hausdorff dimension!
The packing dimension $\dim_P U$ of a set $U\subset X$ (for any metric space $X$; I do not write the dependence on $X$ explicitly) is defined as follows. First we define pre-packing $s$-dimensional measure $P_s$ as follows:
$$
P_0^s(U) = \sup\left\{ \sum_i r_i^s: B(x_i,r_i) \text{ is a packing of } U\right\}.
$$
$P_0^s$ is not countably (or finitely) subadditive in general, so $s$-dimensional packing measure is defined as
$$
P^s(U) = \inf\left\{ \sum_i P_0^s(U_i):U\subset \bigcup_i U_i \right\}.
$$
Then, as for Hausdorff dimension, the packing dimension is defined as
$$
\dim_P(U) = \inf\{ s: P^s(U)=0 \} = \sup\{ s: P^s(U)=+\infty\}.
$$
As mentioned above, if $\dim(U_1)=\dim_P(U_1)$, then one does have
$$
\dim(U_1\times U_2) = \dim(U_1)+\dim(U_2).
$$
This is not completely trivial but follows from the definitions.
All of this can be found e.g. in Mattila's book "Geometry of sets and measures in Euclidean space"
Now, most (though by no means all) sets one encounters in practice do have equal Hausdorff and packing dimensions. These include, for example, self-similar sets (even allowing overlapping), sets invariant under conformal dynamical systems, many random sets such as Brownian paths and graphs, more general Cantor sets defined inductively if the number and location of the pieces is not "too wild" and so on. So this is a large and natural class on which the hypotheses in the OP are met.
Moreover, packing dimension satisfies the opposite inequality for product sets:
$$
\dim_P(U_1\times U_2)\le \dim_P(U_1)+\dim_P(U_2).
$$
This means that if $\mathcal{U}$ is the class of sets $U$ in a (compact, say) metric space $X$ such that $\dim(U) = \dim_P(U)$, then $\mathcal{U}$ is closed under products.
A sufficient (but far from necessary) condition for equality of Hausdorff and packing dimensions of $U$ is the existence of a measure $\mu$ on $U$ such that (for some constant $C>1$)
$$
C^{-1} \, r^s \le \mu(B(x,r)) \le C \, r^s \text{ for all }x\in U.
$$
Such sets $U$ are called Ahlfors-regular and as you could expect, the common value for the dimension is $s$.
I'm not familiar enough with tropical geometry but I suppose that if we consider the space of all finite cartesian products of sets/metric spaces with equal Hausdorff and packing dimension, then Hausdorff dimension would be some sort of tropical morphism from this space to the reals.