Generally, blessings are recited before performing a mitzvah—such as before eating matzah or before lighting the Chanukah candles.

There are two exceptions to this rule: netilat yadayim (ritual hand-washing, whether before eating or upon awakening in the morning) and Shabbat candles.

The reasons for these exceptions:

Netilat yadayim: Hands are often unclean before the washing. Hence, out of respect for the One whom we are blessing, we wait until after washing before reciting the blessing.

[When washing before a meal, the drying of the hands is also part of the mitzvah, and we recite the blessing after the washing but before drying. As such, to some degree we still follow the rule of saying the blessing prior to (part of) the mitzvah.]

Shabbat candles: With the recitation of the blessing on the candles on Friday afternoon, the women usher in the Shabbat. Once the Shabbat has begun, lighting candles would be forbidden. The blessing is, therefore, recited after the candles are lit.

[Interestingly, here, too, we complete the mitzvah only after reciting the blessing. Women cover their eyes immediately upon lighting the candles until after finishing the blessing, so as not to benefit from the light of the candles—which is the completion and objective of the mitzvah.]

Best wishes,
Rabbi Baruch S. Davidson