The Dharmaguptaka school was one of the old 18 to 20 early schools of Buddhism that arose before the arrival of Mahayana Buddhism. Mahayana Buddhism is really just a blanket term we use to refer to groups that started following various new sutras that were written after this period which have an emphasis on Bodhisattva practice and various other new doctrines.
When this Mahayana movement started out, it wasn't yet a defined school and didn't have any organization, and its followers were just members of the other early sects who chose to follow these texts. For example, it was common for a period of time for a Saravastivadin monastery to have Mahayana and non-Mahayana monks living and practicing together. Because they followed the same Vinaya, it didn't really matter. Eventually in India however, Mahayana Buddhism developed into distinct schools such as Madhyamika, Yogacara, etc... and all that remained of most of these schools were their canonical texts (which were still upheld as canonical by the Mahayana schools) and their ordination lineages.
In brief, for a time, some Dharmaguptakas were Mahayana, and some Mahayana were Dharmaguptaka. Some Sarvastivada were Mahayana, and some Mahayana were Sarvastivada, and the same pattern repeats for almost all of the sects. Eventually though, the only non-Mahayana school to live on as a body of teachings rather than just an ordination lineage and a textual transmission was the Theravada school, and all the non-Theravada lineages were simply absorbed into Mahayana Buddhism.