To "master the subject" means to become highly skilled and knowledgeable about a particular topic or field of study. Essentially, it means to have a deep understanding and complete control over all the aspects and details of that subject.
Full definition