When you learned the sine function using the definition
$$
\sin \theta = \frac{\text{opposite}}{\text{hypotenuse}},
$$
you learned about a function whose domain is just the values $\theta$
such that $0 < \theta < \frac\pi2$.
If you are OK with defining certain degenerate triangles a certain way,
you can extend this to $0 \leq x \leq \frac\pi2$.
But you cannot construct a right triangle with angles outside
that domain, at least not in ordinary Euclidean geometry.
The sine function that mathematicians actually use, however,
is defined over all the real numbers. There are various ways to do this;
one that I like is to draw a unit circle around the origin
of an $x,y$ Cartesian plane,
and then, starting at $x=1, y=0$, travel a distance $\theta$
counterclockwise around the circle
to reach a point $(x_\theta,y_\theta)$.
Then $\sin\theta = y_\theta$.
For $0 < \theta < \frac\pi2$, the triangle
$(0,0), (x_\theta,0), (x_\theta,y_\theta)$
is a right triangle such that the angle at $(0,0)$ is $\theta$,
the hypotenuse of the triangle is $1$,
and the side opposite $(0,0)$ is $y_\theta$.
Hence for those angles,
$$
\sin \theta = \frac{\text{opposite}}{\text{hypotenuse}}
= \frac{y_\theta}{1} = y_\theta,
$$
which agrees with the definition you learned.
That is, the mathematician's sine function is just an extension of
the function you learned to real numbers less than $0$ and greater than
$\frac\pi2$.