Hi. Did you dechlorinate the water? Tap water contains either chlorine or both chlorine and chloramine - two substances that kill fish immediately. If you did not dechlorinate your tap water, that is why the fish died.
Another thing now. People new to the hobby often to not know about "cycling" a tank. Here is what it means. You should never buy the fish the same day that you bought your tank. Not even a few days after. In a new tank, there are no beneficial bacteria that remove toxic substances. So even if you put fish in the tank a few days after, they'll still most likely die because the tank was not cycled yet.
Cycling a tank means setting it up and running it for about a month before buying fish. During this time, the tank goes through a nitrogen cycle. First ammonia builds up - ammonia is a toxic substance that will kill your fish if it is present in the water. Then a type of beneficial bacteria develop that convert ammonia into nitrite. Nitrite is still very toxic, so then another bacteria develops that converts nitrite into nitrate. Nitrate is not as toxic as ammonia and nitrite, but it should be kept as low as possible. To remove nitrate from your water, you perform weekly or bi-weekly water changes (ex. changing 10% of water weekly, or 25% of water every 2 weeks). And of course, every time you add new water to your tank, it must be first dechlorinated.
You should buy a test kit to measure your water parameters, and to see if it is cycled. The test kit has ammonia, nitrite, nitrate, and pH tests. You tank is cycled when ammonia = 0, nitrite =0, and nitrate =0 (or is very low). And this is when you can start adding fish. You should also research what pH your fish prefer.
So, after you had your tank running for about a month, the water is cycled and ready for fish. BUT, not for all the fish at once. You stock your tank gradually - adding only few fish at a time. If you add a lot of fish at once, ammonia or nitrite will quickly increase and also kill your fish. This is because there are still not enough beneficial bacteria to support a lot of fish. But when you stock your tank gradually, then the bacteria also increase gradually, and this way you can add more and more fish but by small numbers only.
You should never overstock your tank either. The general rule is to have 1 inch of fish per 1 gallon of water. Or better - 1 inch of fish per 2 gallons of water. However, this is only a general rule. what you have to take into account is not only the length of the fish but also its body mass. A fish may have only a few inches of length, but it may be very massive. Here, you cannot simply use the 1" / 1 gallon rule.
So this is a very brief introduction I guess. On FishLore there are many articles for beginners about cycling, and anything else you should know. There are also many informative posts here, so you can read them and learn from them.
Good luck with your new hobby, and be patient
