What sort of calculations do the miners have your computer do? I recently heard of a new cryptocurrency (or maybe it's not new and I'm just out of the loop) called Gridcoin which uses your GPU/CPU/ASIC to do research calculations rather than "meaningless" calculations.

I had previously thought that Bitcoin miners have your computer do calculations required to process Bitcoin transfers, and then takes a little bit off the top as payment for doing the calculation. If that's true, then why do all the Gridcoin articles say that the calculations are useless?

I'm trying to understand the actual details behind Bitcoin further, and there's very little information out there that's accessible to the layman.

What does the miner have my computer do when I'm mining? And why weren't "more useful" cryptocurrencies such as Gridcoin developed earlier? Why does the system reward you for meaningless calculations, and how is that sustainable?
The calculations are fairly meaningless, it's a pot luck type process so that it is fair for all. They aren't /useless/ though - because they are what power the vast and incredibly secure Bitcoin network.

Edit (elaboration):
Bitcoin hashing is sha256(sha256()) (i.e. sha256 twice.. just for extra protection from sha256 attacks)..  the input to the sha256 algorithm contains various data that identifies the "solution" to the next block.. so it'll have data like the previous block hash, a timestamp, and a hash for transactions included in the block. 

If a miner finds a valid solution then the node verifies and accepts it and broadcasts it to other nodes. If enough nodes receive and verify this solution then it becomes a block and all miners move on to the next block solution. Because mining is random there is no historical data lost when someone else finds a block - every miner has the same chance (proportional to their hash rate of course) - they just repeat sha256(sha256()) over and over. In order for a solution to be valid it must fit all previous blocks and must be a number low enough (defined by the current network "difficulty" level).