TDF works by inhibiting the activity of reverse transcriptase, an enzyme crucial for the replication of viruses such as HIV and Hepatitis B. By blocking this enzyme, TDF helps reduce the viral load in the body, allowing the immune system to function more effectively.