To “mine” - you need cpu power (or gpu) - in other words, the site you visit secretly lets your computer do some work computing the next “coin” - if enough ppl visit the site, there are then hundreds of computers all working for the site. It costs them nothing to let this run on your computer but they get all of the profit if the “mine” a new coin.
As to “mining” - it is actually rather complicated, but, in a nutshell, a unique value needs to be crpytographically computed which then becomes the coin. When these things start, a coin can be mined in a matter of minutes on a simply computer. After a while it gets harder and harder to comute the value and entire server clusters are used and it can take days or weeks.
So, if a site can “borrow” your CPU to take care of some of the load, they have more power to compute without buying more hardware.
“...in a nutshell, a unique value needs to be crpytographically computed which then becomes the coin.”
Here is where you lost me. How do they “cryptographically compute” a value?