Blockchain is one of several types of Distributed Ledger Technologies (DLT), which is a class of technologies analogous to traditional databases, in its purpose to store data, but in which, by design, data is consensually shared and synchronized across multiple sites, institutions or geographies.
Distributed ledgers are purpose-built to enable more transparent and efficient digital transactions between multiple participants with varying levels of trust. You should think of a distributed ledger not as a simple database or record of data, but as a decentralized and transparent universal computer serving multiple organizations and participants.
Perhaps the most notable feature of blockchains and modern distributed ledgers is keeping data immutable.
Due to their decentralized nature, they are more resistant to malicious changes by a single party.
For an attack to be successful, the majority of the ledger copies and network nodes would have to be compromised simultaneously.
Consensus mechanisms enforce the immutability of data over time, by making sure it is either too expensive or unpractical to attempt such an attack.
In the scope of DLT, consensus algorithms are normally protocols and sets of rules ran by network nodes with two main purposes: approving transactions in a distributed manner (and writing them on the ledger) and enforcing the immutability of stored data.
Consensuses in DLT can be looked at from 2 perspectives: Business-driven, resembling voting and rule-based systems organizations use every day to verify and approve transactions; Computation or technology-driven, which focus on ensuring overall system reliability, namely making it technically unfeasible for a single entity to compromise the immutability of the ledger.