Question: why t is pronounced as d?
Answer: T and D use the exact same mouth position, but T is unvoiced and D is voiced. When a T is between two vowels, it's easier to just maintain the voicing, so it comes out sounding pretty close to a quick D sound. Betty butter later latter matter etc. all are pronounced with a voiced flap.