As a student we didn't have interest in every subject of computer science because some of these subjects have different domains of learning. But in case if you have didn't properly done with one subject you are not able to get through the other important subjects like #CC , #Automata, #Data structures etc. what should we do in that case if we have no interest in these subjects like #Machine Learning and (#Data analysis and algorithms) and also the instructor make these subjects more boring for us?
I hate to be unkind, but I wonder if you are blaming others for your own lack of effort and commitment. I don't think that everything that you need to study needs to be "interesting" before you make a success of it. Some things just need to be done and done well. It is hard, of course, when it isn't interesting, but if you have a goal then you can work through that.
My own experience in grammar and early secondary school was that I was a complete loss and wasn't interested in anything there. But I had no goal, so it didn't matter. I eventually "came 'round" but I was a late starter. My only goal in school was to not be there.
But if you can't work through hard things when you do have a goal, then you aren't likely to be successful as every minor rock becomes a mountain to get over.
If you think your instructor is "boring", maybe s/he is, but that should be a challenge to learning, not a block. You don't help yourself by just quitting when the subject or the presentation is boring. The tasks are the same. You need to do a lot of exercises, write a lot of programs, etc. Hopefully the instructor will find a way to give you the necessary feedback, but there are books, etc. that cover the material. Not every teacher will be Michael Sipser, though you will be lucky if you find a few who are exemplary.
Your education is your responsibility. It isn't something dumped into your head by others. Being entertaining isn't actually part of the job description of any teacher. Setting the conditions in which learning can occur is, of course. But that mostly involves setting tasks for the student and then evaluating them and giving feedback.
To answer the question directly: focus on your goals and use them to smooth out the hard bits. Don't focus on the difficulties and miss your goals.
Motivation to work through "boring" material can be from knowing that it is the required foundation for more interesting stuff. Or you might try to find some interesting angle to it. Perhaps it is presented to you in a way that doesn't match your style, look for alternative expositions (other lecture notes, videos on YouTube, rummage around in Wikipedia to see if any interesting connections show up).