In general, they're not similar.
In any triangle with side lengths a, b, and c, we have the aptly-named triangle inequality that says the largest side is no larger than the sum of the smaller sides. In other words, if a and b are both smaller than c, then
a + b ≥ c
Suppose x < 12. Then BC corresponds to either YZ or XY.
• If BC corresponds to YZ, then the triangles are similar if and only if
BC/YZ = AB/XY = AC/XZ
x/2 = 9/3 = 12/4 = 3 ⇒ x = 6
• If BC corresponds to XY, then triangle similarity means
BC/XY = AB/YZ = AC/XZ
x/3 = 9/2 = 12/4
but this fails because 9/2 ≠ 12/4 = 3.
Suppose x > 12. Then BC corresponds to XZ, and
x/4 = 12/3 = 9/2
but this also fails because 12/3 = 4 ≠ 9/2.
(We ignore the case of x = 12 because that would make ∆ABC isosceles, and ∆XYZ certainly is not.)
So ∆ABC and ∆XYZ are similar only if x = 6. Under this condition, similarity would follow from the SSS similarity theorem.