When sodium nitrite (NaNO\(_2\)) reacts with hydrochloric acid (HCl), it produces nitrogen dioxide (NO\(_2\)) and nitrous acid (HNO\(_2\)). Nitrogen dioxide is a gas and the other product, nitrous acid, is unstable and decomposes to form more nitrogen dioxide and water. This reaction can be represented as:
\[
2 \, \text{NaNO}_2 + 2 \, \text{HCl} \rightarrow 2 \, \text{NaCl} + \text{NO}_2 (g) + \text{H}_2\text{O} + \text{NO} (g)
\]
Therefore, the two gaseous products formed are \( \text{NO}_2 \) and \( \text{NO} \), confirming that \( X \) is NaNO\(_2\).