It requires dedication to the subject matter, regardless of your interest in the material. There is no question that if you are interested in a subject, concentration comes easily. However, if the subject seems boring to you, it will usually be difficult to concentrate, thus you can be easily distracted. Actually any subject can be made interesting with the right set of stimuli.
Some instructors are more skilled at making a topic exciting than others.
You, as a student, can make a given topic or subject more fascinating if you put your mind to it. Conversly, if you are determined to make a subject boring no matter what the instructor is doing, then you are doing yourself a disfavor. Give each topic a fair chance. Do your part and as a result you will find it easier to concentrate on the material and that will translate into higher grades. Don't talk to your friends when the instructor is lecturing OR when one of your fellow students is participating in classroom discussion.