It's convenient at the very beginning, to think of CDEFG as thumb,index,middle,ring,pinky. But it doesn't set you up for anything that follows, as you found out. So, yes, you're learning wrong.
Instead, consider each note and where it lives - D for instance is always between the two black keys. Whichever finger presses that D, it will always be 'that D'. You've also realised that sometimes you need to move your hand across, to encompass the next few notes that you want to play. That's good, and will happen all the time. Sometimes, you'll have the possibility of playing several notes with a choice of fingers - that also happens all the time.
So, look at which notes need playing, and try to centre your hand so your fingers can reach all, or most of them. Learning scales and arpeggios will help with articulation of your hand and fingers - how you need to glide your hand sideways, to put the thumb, or another finger, on notes that are just out of reach.