So first off in Mining lets assume you don't know what the terms GPU and CPU are.
The CPU is the Central Processing Unit, which is the main component of your computer, today's processors are quite good at doing maths fast.
Then there is the GPU this is the Graphics Processing Unit. There are two types On-Board is Discrete. The On-Board GPU really isn't any use in mining, other than to put a picture on your monitor. It's Discrete GPU's we will be discussing. GPU's are even better at maths that a CPU in most cases.
Both CPU and GPU can be used for Crypto Mining, each cryptocurrency uses different hashing algorithms to solve the transaction blocks which your mining software takes care of.
Bitcoin uses SHA-256 hashing algorithm, Litecoin uses Scrypt hashing algorithm and Dash uses X11 hashing algorithm. There are now over 55 different algorithms in use across 000's of coins.
As efficient as today's modern CPU and GPU's, in most cases an ASIC/">ASIC will always win not only in Raw Processing, but in Energy usage.
Generally GPUs will outperform CPU's at any price point with modern hardware and consume less power and give off less heat. However some coins are ASIC resistant and lend themselves better to CPU's. An example of this is Monero, which can even be mined in your browser, how simple is that!
AMD's new Ryzen and Threadripper CPU's can mine Monero as speeds like the best GPU's. Certain Intel Xenon processors with big core counts and good cache can also show good hash rates.