Because there is political value in supporting people's freedom to choose and rejecting totalitarian actions of political adversaries.
He could have easily encouraged people to wear a mask and set an example by wearing one himself.
But you're right that it was about political value. Or at least perceived political value.
I don't know Trump's motives, but for many people, this is about freedom and rejection of power tripping bureaucrats and politicians.
So again, this _clearly_ had nothing to do with freedom or totalitarianism.