When hydrogen peroxide and potassium iodide react, they undergo a redox reaction. In this reaction, hydrogen peroxide is reduced to water, while potassium iodide is oxidized to iodine. The iodine produced in this reaction is what causes the colour change. Iodine is a dark brown or purple compound, so when it is produced, the solution will turn a dark brown or purple colour.
The overall reaction can be represented as follows:
2 H2O2 + 2 KI -> 2 H2O + 2 KOH + I2
The hydrogen peroxide acts as an oxidizing agent, oxidizing the iodide ions to iodine. The potassium hydroxide produced in the reaction is a base, which helps to neutralize the hydrogen peroxide.