Why is the thymine base in DNA swapped for uracil within RNA?

Your question is actually the wrong way around, what you should ask is why is uracil converted to thymine for use in DNA?

In nucleotide biosynthesis, uracil is methylated to become thymine; this has several functions including reducing the promiscuity of uracil (which can bind itself, and other nucleotides), restricting the thymine to binding only with adenosine and retaining fidelity when DNA replicates; and also providing methyl-protection to DNA, protecting it from some ubiquitous nucleases that are more commonly used to chew up short-lived messenger RNA molecules once their function has ended.

In the RNA-world hypothesis, which posits that RNA existed first, and was thus the early basis for self-replicating life, the subsequent evolution of biochemical pathways to make the chemical modifications necessary for DNA-specific bases such as dTMP (thymine), seems more logical.