Is there some sort of algorithm to calculate transaction speed? I'm wondering if there's a way that I can calculate how long it will take for a transaction of x BTC paid a y fee to get z confirmations based on current difficulty
The creation of blocks is purely random but does trend towards 10 minutes per block. The lower z is the less accurately the predictions will be.  It is up to the miners to decide which transactions they include, different mining pool software can choose different transactions, thus there is no formula to determine the answer to this question.  It will always vary.