Positive commandment · Mitzvat Aseh #93 of 613
Shaving the nazirite and bringing his sacrifices
לגלח הנזיר שערו על קרבנותיו במלאות ימי נזרו, או בתוך ימי נזרו אם נטמא
The verse · Bamidbar 6:9
וְכִי־יָמוּת מֵת עָלָיו בְּפֶתַע פִּתְאֹם וְטִמֵּא רֹאשׁ נִזְרוֹ וְגִלַּח רֹאשׁוֹ בְּיוֹם טׇהֳרָתוֹ בַּיּוֹם הַשְּׁבִיעִי יְגַלְּחֶנּוּ
“And if any man die very suddenly by him, and he has defiled the head of his consecration; then he shall shave his head in the day of his cleansing, on the seventh day shall he shave it.”
The Rambam’s words
For a Nazarite to shave his hair when bringing his sacrifices at the conclusion of his term as a Nazirite, or during his Nazirite term if he becomes impure, as [Numbers 6:9] states: "Should a person die in his presence,... [he must shave....]"
לגלח הנזיר שערו על קרבנותיו במלאות ימי נזרו, או בתוך ימי נזרו אם נטמא, שנאמר: "וכי ימות מת עליו" (במדבר ו,ט).
Who & when
“And it is practiced at the time of the [Temple] by males and females.”
Where in the Mishneh Torah
Hilchot Nazariteship הלכות נזירות