Can someone give an explanation for why the t-test "happens"? I was taught to use the t-test when you don't know the population standard deviation (i.e., you only know the standard deviation of your sample), but I'm not sure why that would make it different from a z-test.
I don't think I understand your question completely. Are you asking why you would use a t-test?
If you understand why you would use a z-test, you should have a good idea of why you would use a t-test. For large samples, a z-test and a t-test should render similar or identical results. But while a z-test will assume a normal distribution, a t-test will take into account uncertainty in sample distribution at smaller samples sizes.
The z-test is the difference between your two population means over the standard deviation. Or, it can even be the difference between a population mean and an individual score. The t-test is the difference between your two sample means over the standard deviation of the sample means (standard error). They can be used very different ways and mean different things.
With a z-test you know the population variance and you can make statements about percentile ranking or probabilities of scores this high or higher appearing, etc. The classic is the IQ test with a known mean of 100 and SD of 15. If I get an individual's score I can percentile rank them (like SAT, or other standardized tests).
Such isn't really available with a t-tests because it's only about assessing whether you have found a significant difference between your two groups. This is because it's typically about when you have small sample sizes and a high degree of uncertainty about whether the means you've estimated really are where you think they are. That's also why a good t-test calculator will often give you a confidence interval of the difference. You don't know the true difference.
Some people also have a hard time getting around the idea that you would still use a t-test with a very large N to assess the difference between two groups is significant in your sample. This has to do with the fact that two real distributions can have very large amounts of overlap, but still be different. What if I know two population IQ scores, one is 99, and one is 101. They overlap a lot. But I know the populations scores, they ARE different. A z-test doesn't show them to be different in some p-value sort of way because the standard deviations are still 15. But, because a z-test is based on the standard error, which is a measure of how well you've actually estimated a given mean, NOT the population variability, it can get arbitrarily small as the N gets higher and allow you to assess whether those populations are different from each other in your given test. So, for testing differences you would still use the t-test.
(OK, if you really knew the populations were different you wouldn't even bother testing.... but how did you ever know in the first place?... that's right, someone did a t-test... probably several... and established a known effect size)