There are many students (subject being basic sciences) in my university (considered a good university in India) who simply do not care about the subject in a course but have stellar grades. They aren't interested in the subject per se, just the grades. These students never doubt anything that the professor says or whatever is written in lecture notes. They never ask questions. They would happily write in exams what they have memorised without understanding it 'deeply'. When I discuss anything with them about a particular topic which I don't understand, they simply don't care about it and tell me to not think about it 'deeply', and just memorise the stuff. But these students have stellar grades.
A lot of students, almost all that I know at my university, engage in malpractices during the exam, especially in the current online mode when there is no supervision. Some students sit in groups of 6-7 students during an online exam and discuss the questions before submitting, i.e. they solve the exam paper collectively. They often get exactly similar marks as well. Many instructors turn a blind eye towards this.
I sometimes feel jealous of the other students and get agitated at the university system as well. The 'other' students get good opportunities for research internships when they have explicitly mentioned to me that they don't care about research and are doing internships just for the sake of improving their resume.
I, on the other hand, have extremely poor grades. I've failed a 3 courses too. I spend a lot of time thinking about the stuff. I ask questions to the professors, which are received encouragingly. Some professors have explicitly mentioned that my questions are good and it shows that I have thought about the material well. I ask questions and answer questions on Stack Exchange as well, and they are received warmly as well. I am interested in pursuing research after my undergraduate studies but no good university is going to accept me as a grad student considering my poor grades.
I am not saying that my failure is entirely the fault of others. I recognise vices in myself too.
What should I do in order to improve my situation?