Intermediate value theorem for $\sin x.$ How is intermediate value theorem valid for $\sin x$ in  $[0,\pi]$?
It has max value $1$ in the interval $[0,\pi]$ which doesn't lie between values given by $\sin0$ and $\sin\pi$.

In general, any time you have a theorem, "If ____, then ____," it really means, "If ____, then ____ and maybe some other stuff not mentioned here also happens."
Because when you're working in just about any branch of mathematics,
no matter how thoroughly you describe the implications of any mathematical fact there is always some other possible case you could have said something about but didn't.
The only things you can rule out are the things the theorem explicitly says cannot happen.
Unless a theorem says "and there are no other values outside this interval,"
don't assume all the values are inside the interval.
In your example, the value $\sin(\pi/2)=1$ is part of the "other stuff"
that "also happens."
