Imagination is a powerful tool. It can carry us into areas that no one before has ever conceived of, it can solve problems, it can pull beauty from nearly nothing. Imagination is essential to a writer. So why then, are new writers so often admonished to "write what you know?"
The truth is, for a writer who knows themselves, there is no contradiction.
Our imaginings are the product, just as everything else about us, of a combination of genetics and instinct with experience. It serves a function in our personal cognitive and social development (and in our development as a society, allowing humanity the diversity and adaptability that makes us so distinct from other species...even our ability to communicate with one another through language involves a level of abstraction that's greater than most species and thus an imagination to interpret - but that's another topic.)
In short, even the most grandiose or unusual imaginings are founded on things we know. But for most writers, imagination is not a problem. Those of us who are driven to create are more likely to have an active imagination that tends to wheel off in its own direction, that becomes it's own incentive to create. Thus, the admonition "write what you know" is a way to help ground our work.
It can function in the basic sense of knowing your material. Do research, character background studies, and know the reality behind the story.
It can function to encourage writers to experience life, to have a broader range to draw from.
But I think that the most useful and powerful function of writing what you know is specificity. The more specific and personal a work, the greater the likelihood that it will transcend itself and become universal.
It becomes "real" in ways we can't anticipate when we know that a brand of tennis shoes that were popular in a time a place our characters occupy, when we know that a certain carpet color is common to cheap motels built in the 80's, when we know how you hold a fishing line and how much room you need to cast a fly. Because when we know these things, our audience has a point of reference, and it becomes real to them.
Humans are social. We desire belonging, we are constantly (usually unconsciously) searching for connection. When a writer provides points of connection by giving specific, clear details, then the audience will join them.
It becomes "real" in ways that are surprising when we talk about our bi-racial friend who buys giant dubs to prove he's black while bragging about "sounding" white on the phone. Or about the dweeb who tells us for weeks how beautiful and sexy we are, turning up when we're out for coffee or at the grocery store, but the minute we say clearly that we're not interested pointedly calls us a fat bitch, and then whines because being a "nice guy" gets them nowhere. And the feeling of helplessness as we watch our mother on life support, surrounded by plastic tubes and wires that seem to hold a once-dynamic woman in stasis. The more specific you are about your experiences, the more likely you are to have people tell you they understand, and that it's "just like" something they've gone through.
So that feeling of helplessness gets attached to an image of an astronaut, so dependent on the tubes that connect her to life. Or the dweeb backs up their aggressive response to rejection with a knife. And bi-racial guy becomes a human raised in an alien environment. Focus on the specifics, and these situations will become familiar not only to us, but to an audience.
Thus, a writer must know themselves, so that when they do imagine flying, they can place the sensation of the rush as they dive through the air as something akin to riding a roller coaster. So that when feel a rush as they ride a roller coaster, they can think: this is what superman feels like when he's flying.
Know yourself. Pay attention. And then write what you know.