For me, as I mentioned yesterday, my subconscious is much smarter than I am. Where did it come from? My imagination, of course, but also every book I've ever read, every movie I've ever seen, every song I've ever heard...it's all inside my head, somewhere. We don't have conscious recall of everything (99.999% of us don't) but it is there. So I've been absorbing story structure, the hero's journey, the monomyth, legends, parables, fables: in short, stories, all my life. I'll bet you have, too.
All good writers, read. They read in the genre's they love and that they want to write. But if they're smart, they'll also read History, Biography, Poetry and fiction outside their favorite genre.