This used to happen to me all the time on my work laptop. I have a Lenovo Yoga 2. Believe me, it's the touchpad. I'd be typing something and then all of a sudden the cursor would jump to some earlier part of the text and start inserting letters into the existing text. I hit the freaking roof every time it happened. Sometimes you can touch the pad accidentally with your palm without even realizing, despite how careful you're being.
Look in the settings for the trackpad. If it's a Synaptics device like mine, there should be a setting somewhere called "palm tracking" or "PalmCheck." If you set that to maximum, it will recognize when you've accidentally brushed the pad with your palm and reject it. Even if you're confident you're not hitting the touchpad, try this setting anyway.