Secondary dominant
A secondary dominant briefly treats a chord other than the tonic as a destination.
A local spotlight
In C major, D7 is not fully diatonic because of F-sharp. Moving D7 to G makes G feel briefly like a goal; the analysis is V7/V, or dominant of the dominant. That is different from a confirmed modulation to G major, which needs stronger evidence of a new key.
Try one chromatic note
Play C–Dm–G–C, then C–D7–G–C. Only the F in Dm needs to rise to F-sharp for the D chord to become major, and C can be added as its seventh. Listen to how the G arrival gains emphasis. Keep the altered chord short if you want a quick lift rather than a new section.
Check the destination
A chromatic major chord is not automatically a secondary dominant. It should point convincingly to a following chord. If it never resolves, describe what the bass and melody actually do instead of forcing a V-of-something label.
Related entries
Further reading
These source links provide technical background; the exercises above are Eidolon's own editorial guidance.