In a right triangle, relative to a $45^\circ$ angle, if we have $$\text{adjacent} = 1$$ $$\text{opposite} = 1$$
then $$\text{hypotenuse}=\sqrt{o^2+a^2}=\sqrt{1^2+1^2}=\sqrt{2}$$ so that $$\sin 45^\circ=\frac{1}{\sqrt{2}}$$
But, when $$\text{hypotenuse} = 1$$ $$\text{opposite} = \text{adjacent}$$ then (writing $o$ for $\text{opposite}$ and $a$ for $\text{adjacent}$) $$\begin{align} o &= \sqrt{h^2-a^2} = \sqrt{1^2-o^2} \\[4pt] \implies \quad o^2 &= h^2-o^2\\ &=1-o^2 \\[4pt] \implies\quad 2o^2&=1 \\ \implies\quad o&=\sqrt{\frac{1}{2}} \end{align}$$ so that $$\sin 45^\circ =\frac{\sqrt{\frac{1}{2}}}{1}$$
What went wrong?
Nothing went wrong. $$ \frac{\sqrt{\frac{1}{2}}}{1} = \sqrt{\frac12}=\frac1{\sqrt2} $$