Is the correlation between learning a subject and having high grades strong?
There's no general answer to the question. It depends on the individual course.


If the course is designed so that grades are earned for demonstrating achievement of a learning outcome, then there will be a strong correlation between having high grades and achieving the learning outcomes of the course.
If the course is designed so that grades are earned for things that don't demonstrate achievement of a learning outcome, or so that students can achieve a learning outcome but not have an opportunity to demonstrate it to earn a grade, then the correlation will be weak.


Also, your general description of "learning a subject" may not necessarily be strongly correlated with the desired learning outcomes of a course. It's possible to earn a poor grade for a well-designed course even after having "learned the subject" if the course has specific learning outcomes (i.e., "Students will know how to solve a certain class of problem," "Students will have learned this particular skill") and what you are learning about the subject happens to be orthogonal to those learning outcomes.