Traditionally, a university had four faculties, the lower or artists faculty, and the three higher faculties of theology, law and medicine. Students would start in the artists faculty learning the seven liberal arts (grammar, rhetoric, logic, arithmetic, geometry, music, and astronomy (including astrology)) to become a magister artium (M.A.) and then go to one of the higher faculties to get their doctorate (Th.D, LL.D or M.D., respectively). Philosophy and science (née natural philosophy) developed in the artists faculty and over time became important enough to grant the artists faculty the right to grant doctorates, too, with philosophy leading the way. That's why many science faculties, which split off of the artists faculty over the centuries still grant the title of a doctor of philosophy.
Ah, and the first three of the liberal arts that were the first thing a student learned, grammar, rhetoric and logic, were called the trivium, hence the modern word "trivial" for obvious things everyone should know.