In a few words, a candidate block is a block that a mining node (miner) is trying to mine in order to receive the block reward. So a candidate block may be described as a temporary block that will be either validated or discarded by the network. Miners compete with each other to validate the next block and add it to the blockchain, but first, they have to create a candidate block to participate in the mining competition.
Candidate blocks are created by miners by collecting and organizing multiple unconfirmed transactions from the memory pool. The transactions are then hashed to form a Merkle tree structure, which will eventually produce a Merkle root (or root hash). The Merkle root is a single hash that represents all previous hashes of that tree, and therefore, all transactions that were included in that particular block.
The root hash - together with the hash of the previous block and a random number called nonce - is then put into the block's header. The block header is then hashed by the miner, generating an output based on those components (root hash, previous block's hash, and nonce) plus a few other elements. The resulting output is the block hash and will serve as a unique identifier of the newly generated block (candidate block).
To be deemed as valid, the output (block hash) must start with a certain number of zeros (less than a target value that is defined by the protocol). This means that the mining process is based on multiple attempts (trial and error) as the mining nodes have to perform a myriad of hashing functions with different nonce values until a valid block hash is eventually produced. The block hash produced is what proves that the miner did his work (hence Proof of Work).
After a miner finds a valid block hash, their candidate block will be broadcasted to the rest of the nodes of the network, which will verify the authenticity of the hash. If everything is good, the candidate block will then be recorded into the blockchain. At this point, each validating node updates its copy of the blockchain data to reflect the recent mined block, and the miner will get the block reward.