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}$.
$$\begin{align*}
\tan \theta \sin \theta + \cos \theta & \stackrel{\text{def.}}= \frac{\sin^2 \theta}{\cos \theta} + \cos \theta \\
& \stackrel{\text{Pythagoras}}= \frac{1-\cos^2 \theta}{\cos \theta} + \cos \theta \\
& = \frac1{\cos\theta} - \cos \theta + \cos \theta \\
& \stackrel{\text{def.}}= \sec\theta
\end{align*}$$
Where we use the definitions of $\tan \theta$ and $\sec\theta$ plus Pythagoras' theorem $\sin^2 \theta + \cos^2 \theta = 1$.
Best Answer
For fun, I found a "trigonograph" of this identity (for acute $\theta$).
In the diagram, $\overline{AB}$ is tangent to the unit circle at $P$. The "trig lengths" (except for $|\overline{AQ}|$) should be clear.
We note that $\angle BPR \cong \angle RPP^\prime$, since these inscribed angles subtend congruent arcs $\stackrel{\frown}{PR}$ and $\stackrel{\frown}{RP^\prime}$. Very little angle chasing gives that $\triangle APQ$ is isosceles, with $\overline{AP} \cong \overline{AQ}$ (justifying that last trig length). Then, $$\triangle SPR \sim \triangle OQR \implies \frac{|\overline{SP}|}{|\overline{SR}|} = \frac{|\overline{OQ}|}{|\overline{OR}|} \implies \frac{\cos\theta}{1-\sin\theta} = \frac{\sec\theta+\tan\theta}{1}$$