Proof of Work (PoW) is an algorithm that rewards the first person that solves a computational problem (mining) to achieve distributed consensus.
Miners compete to solve difficult cryptographic puzzles in order to add the next block on the blockchain. It prevents spam and cyberattacks such as DDoS as it requires work (i.e. processing time).