A consensus mechanism is the set of rules a blockchain uses to agree on a single, shared version of the truth. Because there is no central authority, thousands of independent participants need a reliable way to settle which transactions are valid and in what order. The consensus mechanism is how they reach that agreement.
The two best-known approaches are proof of work and proof of stake. Proof of work has participants compete by solving hard computational puzzles, spending energy to earn the right to add a block. Proof of stake instead selects participants based on the amount of crypto they lock up as a stake, which uses far less energy.
Whatever the method, the goal is the same: make honest behaviour rewarding and dishonest behaviour costly, so the network stays secure. The choice of mechanism affects a blockchain energy use, speed, and security, which is why it is a defining feature of any network.