Tenofovir is an antiviral medication used primarily to treat HIV and chronic hepatitis B infections. It works by inhibiting the reverse transcriptase enzyme, which is crucial for viral replication, ultimately reducing the viral load in the body and helping to manage these chronic infections effectively.