Step 1: Locate the problem.
Indigestion happens when the stomach makes too much hydrochloric acid, and that extra acid irritates the stomach lining, causing burning and pain.
Step 2: Think about what would fix too much acid.
The simplest fix for too much of anything acidic is to add something basic to cancel it out. Magnesium hydroxide, $Mg(OH)_2$, is a mild base, mild enough that it will not itself damage the stomach wall the way a strong base like $NaOH$ would.
Step 3: Write what happens when it meets the acid.
\[ Mg(OH)_2 + 2HCl \to MgCl_2 + 2H_2O \] The extra $HCl$ gets used up here, turning into a harmless salt and water, so the acidity in the stomach drops back to a comfortable level and the irritation eases.
Step 4: Conclude.
Magnesium hydroxide works as an antacid because it neutralises the excess stomach acid, relieving the pain. \[ \boxed{\text{Neutralises excess acid, relieving pain and irritation}} \]