As with so many things, you proceed in small steps.
I will not go into too many details because basic things like this depend on definitions and you have not provided any.
First:
$$\textrm{Hom} (X, (A \times B) \times C) \cong \textrm{Hom} (X, A \times B) \times \textrm{Hom} (X, C)$$
This is natural in $X, A, B, C$ and is either by definition of $\times$ or a basic lemma you prove soon.
Note that $\times$ of sets may have a different definition – it doesn't matter, as long as you are consistent.
Then we repeat:
$$\textrm{Hom} (X, A \times B) \times \textrm{Hom} (X, C) \cong (\textrm{Hom} (X, A) \times \textrm{Hom} (X, B)) \times \textrm{Hom} (X, C)$$
This too is natural in $X, A, B, C$, of course.
Now,
$$(\textrm{Hom} (X, A) \times \textrm{Hom} (X, B)) \times \textrm{Hom} (X, C) \cong \textrm{Hom} (X, A) \times (\textrm{Hom} (X, B) \times \textrm{Hom} (X, C))$$
naturally in $X, A, B, C$.
This is supposed to be a lemma you already know – otherwise there is indeed no point using Yoneda for this.
Now we basically reverse the earlier steps:
$$\textrm{Hom} (X, A) \times (\textrm{Hom} (X, B) \times \textrm{Hom} (X, C)) \cong \textrm{Hom} (X, A) \times \textrm{Hom} (X, B \times C)$$
$$\textrm{Hom} (X, A) \times \textrm{Hom} (X, B \times C) \cong \textrm{Hom} (X, A \times (B \times C))$$
Compose all of these natural bijections to obtain:
$$\textrm{Hom} (X, (A \times B) \times C) \cong \textrm{Hom} (X, A \times (B \times C))$$
Then finally use the fully-faithfulness of the Yoneda embedding to deduce:
$$(A \times B) \times C \cong A \times (B \times C)$$
This is natural in $A, B, C$, of course.