Could it be OtherLife?
Ren Amari is the lead researcher at a technology company she co-founded with entrepreneur Sam. Using nanotechnology, Ren invents a biological form of virtual reality called OtherLife that can create realistic memories. A week before the product launch, she is testing its code on herself under the supervision of engineer Byron Finbar. Unknown to the others, she is also privately testing the product on her comatose brother, Jared. Ren hopes that the inserted memories will help him recover, though her father, a professor whose work she based OtherLife on, wants to stop Jared's life support. Amid these issues, her romantic relationship with coworker Danny begins to suffer.
The government is willing to avoid a trial for unlicensed human tests and Danny's death if Ren agrees to one year of solitary confinement in OtherLife. With no alternative, Ren agrees. She is then stuck within a simulation that includes simply a single room and basic necessities of life, including bottled water and canned tuna. After a full year, Ren breaks down when the confinement counter resets to 001 without her release. However, in her rage, she is able to dislodge a wall section and escape. As she emerges, she realizes she had been trapped in a real-world cell. She escapes and makes contact with a sympathetic coworker, who reveals that Danny survived.
It's a woman trapped, not a man, but the ending has a man trapped in a similar cell.
Found with a search for
film man trapped in room with countdown restarts