I have exactly the same problem as you, and what a coincidence, I have played for 2yrs too and have exactly the same problem: not knowing how to groove/improv. To tackle this, I want to a local bass instructor and he solved this big big problem in one lesson. So i hope this will be of some help to you.
He asked me to do one exercise, so-called "The One chord vamp". Basically, it is an exercise in Dm, and to simplify things, he asked me to use just the Dm pentatonic scale, which has just 5 notes. It is just 4 bars:
|Dm(header)|Dm(fill-in)|Dm(header)|Dm(fill-in)||
header: this means a simple groove pattern, in my case, just play 8 8th notes for the whole bar(D-D-D-D-...)
fill-in: just play anything with the notes in the Dm pentatonic scale
the point is, you keep returning to the basic groove after each bar of fill-in. At first, i will get lost, like still messing around in the fill-in when it's time to play the header again(sometimes i found myself still play the fill-in but it's already the 2nd beat of the header bar...but it's okay to be wrong, you are just trying/learning!). Try this a couple of times and you found yourself grooving/improvising. The point is not to have this "i don't know what is improv/groove" in your mind, just play. I complained to the instructor that i have no idea what was doing! In the fill-in part, i was just randomly playing some notes in the pentatonic scale, that's stupid! And his awesome answer "That's how you practice the (pentatonic) scale musically, just mess around with it" And then we tried the exercise a couple of times, he recorded a few of these attempts. I found my playing is not bad! Suddenly i'm improvising!!!
All in all, like other TBers said, it's as easy as just play. Do not overthink it

You can actually make it even more simpler by just messing with the root&fifth. And i found it more interesting to play with a simple backing drum beat too. Hope this help!