For floating point numbers stored in IEEE double precision format, the significant has $53$ bit of accuracy. The most significant bit is implied and is always one. Only $52$ bits are actually stored.
Since $1 \le \frac{\pi}{2} < 2$, among those numbers representable by IEEE,
the closest number to $\frac{\pi}{2}$ is
$$\left(\frac{\pi}{2}\right)_{fp} \stackrel{def}{=} 2^{-52}\left\lfloor \frac{\pi}{2} \times 2^{52}\right\rfloor$$
Numerically, we have $$\frac{\pi}{2} - \left(\frac{\pi}{2}\right)_{fp} \approx 6.1232339957\times 10^{-17}$$
Since for $\theta \approx \frac{\pi}{2}$, $\displaystyle\;\tan\theta \approx \frac{1}{\frac{\pi}{2} - \theta}$, we have
$$\tan\left(\frac{\pi}{2}\right)_{fp}
\approx \frac{1}{6.1232339957\times 10^{-17}}
\approx 1.6331239353 \times 10^{16}$$
This is approximately the number you observed.