Important to remember: Star Trek came first, by over a decade. Star Wars was named that because George Lucas wanted a title that sounded like Star Trek.
Star Trek is based on the concepts and tropes of prose science fiction of the 1930s-60s, with a number of noted prose SF authors writing for the original series. It's noteworthy for distilling those tropes and popularizing them for a mass audience. It's also somewhat influenced by the 1956 film Forbidden Planet, one of the classiest SF films of the era, with a story inspired by Shakespeare and featuring top-notch production values for its day. Its creator, Gene Roddenberry, tried to do something new for series television by making an SF show that was just as adult and naturalistic as any Western or cop show or medical drama of the era, striving for character realism in the scripts and consulting with scientists and engineers to help him build a plausible world. Although it's arguable how successful he was at achieving the desired level of believability, and his successors have not always cared as much about realism. The original TV series spawned an animated continuation, four live-action sequel TV series that all ran longer than the original, and eleven movies to date, the most recent of which is an alternate-universe reboot of the original series. There have been numerous novel, comic, and computer-game tie-ins which are not considered to have canonical status and are often not consistent with one another, although the longest-running line of tie-ins, the original novels which Pocket Books has published for the past three decades, have had an ongoing continuity for over a decade.
Star Wars is a pastiche of the fanciful space-adventure film serials of the '30s-'40s such as Flash Gordon and Buck Rogers, as well as Edgar Rice Burroughs's sword-and-sorcery John Carter of Mars adventures -- material that was more fantasy than science fiction and aimed at least as much at children as adults. Its creator, George Lucas, considers it "space fantasy" rather than science fiction. The original three films were meant to be simply light adventure romps, but the prequel trilogy made a couple of decades later was more serious and allegorical in tone, but less artistically successful. Those six live-action films are the core of the universe's canon, along with the current CG-animated series. There are numerous other tie-ins, including a few older traditionally-animated series, a long-running comics franchise, and books that were initially intermittent but have become far more frequent and interconnected in the past couple of decades as an emulation of the Star Trek novel line; these are treated as "canonical" in the sense that all tie-in authors are expected to treat every other tie-in as "real" even when they contradict each other, but the movies and TV series are free to contradict them, so they're not really canonical.
At its heart, Star Trek is a narrative about exploration, idealism, the embrace of reason over brute force, the idea that enemies are more often misunderstood than evil, and the humanistic principle that intelligence and dedication can surmount any challenge and build a better future. Star Wars is a narrative about epic warfare between absolute good and evil, mystical forces of destiny, and the moral superiority of nature over technology, with the exception of the occasional funny droid sidekick. They couldn't be more dissimilar at the core. Although later Star Trek films and shows have been influenced by Star Wars' flashy, action-driven style in a lot of ways.