I'll take a broad swing, there is nothing CS-specific in my answer. In fact, my own experiences are from mathematics, I know of people who had similar experiences with medicine.
I'll go from a generic view to more personal specifics.
You learn, learn, and learn, keep on collecting information. It seems unneeded, forced, and definitive too much. Then, at some moment, you have a satori.
You suddenly release that all those loose factoids fit together, there is a system behind them. This system makes it easier to understand and "make fit" further factoids and even whole methodic approaches and design patterns in the later studies. You suddenly find out, you can learn faster and gasp the material with more speed.
Actually, in the later life (if you keep on doing this), your learning speed increases further, the famous "ability to gasp complex concepts" that many job adverts want is just miraculously there, etc. Mostly it's not connected with such a cathartic "now I know how the world works" moment, it's the first breakthrough that is so hard. But it's always a nice feeling when it finally happens.
What to do
Keep on. Stay at ball. Continue learning.
You are not the first, and not the last, who has difficulties in understanding "why do we keep learning all this". As far as I know, little can be done to help you understanding the "why", because it actually makes perfectly sense to the lecturers. It just needs to do a "click" in your head. It can take years. No, really.
So, what immensely helps, is to get another perspective. Read a yet another book, possibly: one being touted as a "different view on things". Talk with your fellow students. And please, please, listen to professors and tutors. In many cases the spoken, informal description of things facilitates much better understanding than a fully correct formal description, typically found in books.
Aside from "not understanding why are we doing this" you seem to have a somewhat related problem. You are not getting the information into your head fast enough.
It is related to the "epiphany" thing above. When you finally have a "system" behind the facts and methods you are learning, it is much easier to store more (conforming) facts in your head.
But the minutely problems with learning might suggest that you use different "learning type" approaches than you are. Two things from my personal experience, but you might be radically different in this regard.
Focus on listening to the lecturer and understanding. Too many students are preoccupied taking notes. (I have a feeling, it is even worse digitally. Pen and paper, anyone?)
You might be able to find the material in its formal form online, in a book, or where not later. You might not be able to find an understandable informal explanation of the issue the lecturer gave you orally, when you were to busy coping the formal thing down.
I would say that your goal in a lecture is not obtaining enough learnable material for later revision, as funny as it may sound. Yes, you'd need to obtain it later. But your (minor) goal is to find out, how to obtain it. Your major goal in a lectures is to obtain understanding. "Listen to the music, not to the song."
Taking handwritten notes works best for me. You might be different. I can remember much better the things I have written down. When revising for exams I was writing notes of my actual course notes with book knowledge thrown in. Even worse, for final revision I had notes of the notes! It helped.
It might be hard to listen to the professor and to make notes simultaneously, especially in early semesters. It is a learnable skill, however. You'd become better with time. My personal suggestion is to prioritise listening and understanding to making notes. You will always be able to pull that proof, that exact statement of a theorem, that corner case, and that exact taxonomy from a book or online lecture material. Conjuring understanding is harder.
You seem to be on a right way. Experiment more and find out what works better.
An old (and may be not-so-appropriate nowadays), but quite true statement is that freshmen rather learn how to learn than learn something useful yet. It's in the later semesters when the actual knowledge is transferred. You'd still have trouble both ingesting it, if you are not fast enough, and understanding it, if you missed the foundations from the freshmen years. So, take this saying with a grain of salt.