Bad books on writing tell you to "WRITE WHAT YOU KNOW," a solemn and totally false adage that is the reason there exist so many mediocre novels about English professors contemplating adultery.
- Joe Haldeman)
Bravo, Mr. Haldeman. I've actually heard writing professors telling their students this, sometimes going so far as to suggest "What's wrong with science fiction is that it's not writing about what you know." How boring would literature be if all we did was literally only write about our personal experiences and expertise? We literally could not have a fiction of the imagination or the future or the Other if we constrained ourselves to only what we know. This is why not every single person writes a memoir: The only way to make an average life interesting is through brilliant insights and mastering the tools of humor or conveying emotion or so forth. When that happens, great! But there's a lot more to literature than memoir.
Good science fiction not only poses questions, explores ideas, speculation and extrapolates about possible futures, and offers other mind-expanding goodness, but the best SF also provides deep insight into what it means to be human living in an age of ever-accelerating change.
Science fiction writers have a special obligation to research broadly so that when they write about such technological game-changers as the Singularity or transhumanism or astrophysics, or alternate histories where small but important changes affect our present, or political shifts that change everything about human society, or so forth, the reader can willingly suspend their disbelief.
So in that respect, sure, SF writers inject what we know about the universe around us and people and tech and change and so forth, but if all we do is "write what we know," we wouldn't write much anything at all that has the impact of good SF.
So if you're a new writer, ignore the hell out of that ancient adage... while doing your damnedest to learn everything you can about the alien things you want to speculate about. I suggest these alternatives:
"Use what you know," or "Know what you write [that is, learn it]."
Speaking of writing, here's where I'm at with The Galactic Adventures of Jack & Stella:
While doing a physics experiment at the University of Kansas, Stella found someone to crush on. Of course, the wonderfulness of her day is about to be crushed....