Gold and silver coins had value because the metals themselves had value. Of course, the only reason the metals had value was because everyone agreed that those metals had value. But these coins were based on a value of a particular material.
Bank notes like dollar bills were originally just slips of paper that said that such-and-such bank had a certain amount of gold sitting in its vault. You could go to said bank and hand them the slip of paper and get the gold back. While the paper itself was worthless, it represented something of tangible value.
Dollar bills used to backed by gold. In the 1970s, the U.S. abandoned the gold standard. Now, those paper dollar bills are only worth a dollar because everyone agrees that they are worth a dollar. There is nothing physical backing them up. A dollar bill does have the advantage that a very large government (the United States) says that they are worth a dollar, so that helps. If people lose faith in their government, those dollar bills could become worthless. For a couple of examples of this, you can look at Germany in the 1920s and Zimbabwe in much more recent years.
Bitcoins have value because people want them to have value. They have absolutely nothing backing them up, and unlike paper dollars, they don’t even have the advantage of having any government backing them up. The risk with these types of currencies is that, since they don’t have anything backing them, they could theoretically collapse, possibly overnight, and become completely worthless.
One of the reasons they have value is that you can’t just easily go out and make new ones. Their supply is limited. This is why they need the complex mathematical computations to generate them. One of the reasons Germany’s currency collapsed in the 1920s is that when their economy started to tank, the German government responded by just printing more and more bank notes. Since money was easy to generate, it had no value. Similarly, if bitcoins could be easily generated, then anyone could make a bizillion bitcoins and they would have no value.
On a similar note, the U.S. government prints its own money. We are trillions of dollars in debt. We could easily wipe out that debt by simply printing a few trillion dollar bills and paying our debts. But, if we did that, the value of the dollar would drop like stone and become close to worthless. We do on occasion just print up a bunch more money just because we want to, but it has to be done very carefully and in very limited amounts so that we don’t ruin the value of the dollar.