Since $125 = 5^3$, we have $$5 \cdot 5^{\frac{3}{x}} = \frac{1}{5^{\frac{1}{x}}} \Rightarrow 5^{1 + \frac{3}{x}} = 5^{-\frac{1}{x}}$$
Equating powers gives $1 + \frac{3}{x} = -\frac{1}{x} \Rightarrow x = -4$.
Some explanations:
We have $a^b \cdot a^c = a^{b+c}$, this can be reasoned as such: $$a^b \cdot a^c = \underbrace{a \cdot a \cdots a}_{b \, \text{times}} \cdot \underbrace{a \cdot a \cdots a}_{c \, \text{times}} = \underbrace{a \cdot a \cdots a}_{(b+c) \, \text{times}} = a^{b+c}$$ This gives $5 \cdot 5^{3/x} = 5^{1 + 3/x}$ as promised.
Next, we have $(a^b)^c = (a^c)^b = a^{bc}$, this should make sense if you think of it being $a^b$ multiplied together $c$ times, giving a total of $a$ being multiplied together $bc$ times, since $a^b$ is $a$ multiplied together $b$ times. Symbolically $$(a^b)^c = \underbrace{a^b \cdot a^b \cdots a^b}_{c \, \text{times}} = a^{\overbrace{b + \cdots + b}^{c \, \text{times}}} = a^{bc}$$
This is what lets us write $125^{1/x} = (5^3)^{1/x} = 5^{3/x}$.
I do need to emphasise that my 'explanations' are simply that, visual and handy intuitive explanations, they do not constitute proper proof (as we are implicitly assuming $a,b,c$ are (positive) integers, whilst the stated rules hold for real numbers.