All desktop Processors need a way to get rid of heat. If they didn't produce much heat and didn't need a cooler then they would be no where near as powerful as the current PC processors. The frequency of a processor is measured in Hertz and 1 Hertz means one cycle (this is why the frequency of a processor is called the clock speed). The more cycles a processor does, the more heat generated. Modern processors have frequencies of up to 5GHz, this is 5,000,000,000 Hz which is 5 Billion cycles a second. So to allow Processors to reach these frequencies, a way of cooling them down is needed. This is why we have CPU coolers. A CPU cooler is normally a metal heatsink (this absorbs the heat from the processor and dissipates it through it's large surface area) and a fan to blow cool air onto the heatsink to speed up the dissipation of the heat. But recently water cooling has become popular which is where the water absorbs the heat and the heat is then dissipated by fans and a heatsink.
When buying a processor you sometimes get a CPU cooler with the processor, this is called a stock cooler. For AMD, all of the Ryzen series processors come with an included cooler. I would recommend using them if you don't want to spend the extra money on a better cooler. The higher the TDP (total power draw) of the processor the better cooler you get from AMD when you buy the processor new. For intel the processors used to come with a stock cooler but now any new intel processor will not come with a cooler so you will have to pay the extra £15/$20-£100/$110 for a cooler.
What I recommend it to find out the TDP of your processor (or the one you are planning on buying). If it is 65 Watts or below then you can go for a really cheap cooler and you will have under control temperatures on your Processor but if you want to overclock then I would recommend spending a bit more on the cooler. If it is above 65 watts up to 100 Watts then I would recommend buying a pretty decent cooler (costing £20/$20-£40/$50. If your processor uses above 100 Watts then you should definitely get a pretty beefy cooler that will cost you at least £40/$45. Of course if your processor already comes with a cooler you can still use that.
Intel and AMD have different mounting solutions on their motherboards so to know if the CPU cooler you want fits then find the socket type of your motherboard and find out from the manufacturer or a reviewer if the Cooler fits the socket type you have on your motherboard. (e.g. an AM4 cooler will fit a Ryzen 5 1600)
Also check the height, length and Width of the cooler before buying so you know if it will Physically fit in your case and it won't interfere with the RAM or your Graphics Card.
mid range air cooler, for up to 100 watts
Cooler Master Hyper 212 Black edition, fits: LGA 1366, LGA 1156, LGA 1155, LGA 1150, LGA 1151, LGA 2011, LGA 2011-V3, LGA 2066, AM2(+), AM3(+), AM4, FM1, FM2(+)
Very Cheap air cooler for Processors below 65 Watts
Arctic Alpine 12 CO, fits: LGA 1150, LGA 1151, LGA 1155, LGA 1156
High end Air cooler for pretty much any desktop CPU
Noctua NH-D15. fits: LGA 1200, LGA1150, LGA1151, LGA 1155, LGA 1156, LGA 2011, LGA 2066, AM2(+), AM3(+), FM1, FM2(+), AM4
I do not have much experience with any certain watercoolers so I would recommend if you want water cooling to view some reviews of popular water coolers.
Water cooling is better than air cooling for the first 15 minutes or so until all the water heats up and it becomes as effective as air cooling (sometimes worse than air cooling). Also water cooling fails more often than air cooling and costs more.