In order to make typing easier, I will let $t=x/2$. Replacing $\tan t$ by $\frac{\sin t}{\cos t}$, as you did, is a good general purpose strategy.
So the leftmost side is equal to
$$\frac{1-\frac{\sin t}{\cos t}}{1+\frac{\sin t}{\cos t}}.$$
The next step is semi-automatic. It seems sensible to bring top and bottom to the common denominator $\cos t$, and "cancel." We get
$$\frac{\cos t -\sin t}{\cos t+\sin t}.$$
The move after that is not obvious: Multiply top and bottom by $\cos t-\sin t$.
At the bottom we get $\cos^2 t-\sin^2 t$, which from a known double-angle formula we recognize as $\cos 2t$.
The top is $(\cos t-\sin t)^2$. Expand. We get $\cos^2 t-2\sin t\cos t+\sin^2 t$. The $\cos^2 t+\sin^2 t$ part is equal to $1$, and the $2\sin t\cos t$ part is equal to $\sin 2t$. So putting things together we find that the leftmost side is equal to
$$\frac{1-\sin 2t}{\cos 2t},$$
which is exactly what we want.
The second identity $\frac{1-\sin x}{\cos x}=\frac{\cos x}{1+\sin x}$ is much easier. In $\frac{1-\sin x}{\cos x}$, multiply top and bottom by $1+\sin x$. On top we now get $1-\sin^2 x$, which is $\cos^2 x$. At the bottom we get $\cos x(1+\sin x)$. Cancel a $\cos x$.
Remark: We can play a game of making the calculation more magic-seeming. The middle expression is equal to $\frac{1+\sin 2t}{\cos 2t}$. Replace the $1$ on top by $\cos^2 t+\sin^2 t$, and the $\sin t$ by $2\cos t\sin t$. Then on top we have $(\cos t+\sin t)^2$. Replace the $\cos 2t$ at the bottom by $\cos^2 t-\sin^2 t$, which is $(\cos t+\sin t)(\cos t -\sin t)$. Cancel the $\cos t+\sin t$, and we arrive at
$$\frac{\cos t+\sin t}{\cos t-\sin t}.$$
Now divide top and bottom by $\cos t$, and we get the desired $\frac{1+\tan t}{1-tan t}$.