I disagree that all sci-fi films and TV series are liberal. Star Trek TOS is not liberal, it is anything but liberal.
Star Trek TOS was not overtly liberal. That is mainly because the world of the Federation was never really defined or explained. However, in Star Trek TNG, the future is apparently a communist one in which people don't need money and are happy in their jobs and find recreation through virtual reality simulators.
Also, the OP said "so many" sci-fi films are liberal-not "all".
Liberalism changed since then. In fact it was changing when the series was on the air.
You could make a good case that Kirk was a JFK New Frontiersman. But liberalism turned away from that kind of benevolent expansionism when Vietnam heated up.
That's why the next Star Trek series were so different. They reflected what liberalism became after Kennedy and Johnson.