Read enough interviews with famous musicians and you start to get the picture. They all have some common thoughts about improvisation. The secret is hard work and a desire to move beyond playing other people's music and playing your own. Maybe you can play some fairly advance arrangements from standard notation,tablature, or from memory. But when it comes time to improvise, or to play music to an unfamiliar piece where you might recognize the chord structure, maybe the results don't meet your expectations.
Improvisation is really a method of relying on music as a language.
We play elements and combinations of what we've played before. The better you know the elements of music the better you'll be able to play off the cuff. Most of us can carry on a casual conversation without thought. It's because we're familiar with our spoken language. We've practiced it daily since we uttered our first words.