X is ethanoic acid (CH3COOH). It is acidic and hence turns blue litmus red. It releases carbon dioxide (CO2) when treated with Na2CO3 and NaHCO3 which is responsible for effervescence.
2CH3COOH + Na2CO3→ 2CH3COONa + CO2↑ + H2O
CH3COOH + NaHCO3→ CH3COONa + CO2↑ + H2O