PassIt,
For me it's a little bit of both. Sometimes I'll stumble onto something when I'm messing around with chords and other times I'll hear something in my head that is inspired by other songs, etc. It's very rare that I hear a fully finished song in my head. It's usually just a groove or a piece of a melody that needs to be worked out. The main thing is to be listening for ideas where ever they come in from.
The other thing that I've noticed is that song ideas come to me more when I decide to start working on a song. If I just wait for the lightning bolt of inspiration to come to me it never does. I have to coax it out by working on an idea first, even if it's not very well developed. I think this has a way of preparing you to listen for ideas. Sometimes out of sheer frustration I'll give up on a song and then a week later I'll hear an idea in my head for the next part of the song.
-- Jim