Ash Wednesday is a holy day of prayer and fasting in many Western Christian denominations. It is preceded by Shrove Tuesday and marks the first day of Lent, the six weeks of penitence before Easter.
In the early Christian church of Rome, the length of the Lenten celebration varied, but eventually it began 6 weeks (42 days) before Easter. This provided only 36 days of fasting (excluding Sundays). In the 7C, 4 days were added before the 1st Sunday in Lent in order to establish 40 fasting days, in imitation of Jesus Christ’s fast in the desert.
It was the practice in Rome for "penitents" & "sinners" to begin their period of public penance for the "guilt" of their offences on the 1st day of Lent in preparation for their restoration to the sacrament of the Eucharist. They were sprinkled with ashes, dressed in sackcloth, & obliged to remain apart, until they were reconciled with the Christian community on Maundy Thursday, the Thursday evening of The Lord's Supper, before Easter.
When these practices fell into disuse (8C–10C), the beginning of the penitential season of Lent was symbolized by placing ashes on the heads of the entire congregation. (Probably because we are all, each & every one, "penitents" & "sinners" by thought, word, & deed, each & every day.)