The original run of Star Trek was from 1966 to 1969. During this time, the United States and the Soviet Union were in a Cold War and the threat of nuclear annihilation permeated daily life, the United States was involved in a hot war in southeast Asia, Martin Luther King, Jr. was assassinated, Robert F. Kennedy was assassinated, the Manson Family murdered Sharon Tate and several guests at her home in California, and the Brady Bunch aired its first episode on ABC. Despite the tumultuous times of the 1960s, Star Trek managed to bring a little optimism for the future into living room. If it's out of step today why wasn't it out of step in the 60s?
Although I push back against the idea that the original Star Trek presented us with a utopia. Things were certainly better in that humanity seemed to move beyond many of the problems we had in the 1960s, but life wasn't perfect and many of the characters we run into, including some of the main characters, exhibited flaws including bigotry though they typically managed to overcome them.