The Hebrew /nazir/ means "to separate oneself," and is the origin of the term - Nazirite vow.
The idea is a self-imposed temporary time of higher consecration to God for sanctification, by abstaining from wine (worldly pleasure), cutting hair (worldly adornment) and touching the dead, which makes one unclean. Paul apparently practiced this - see Acts 18:18 and 21:21-26. Samson was a Nazirite his whole life, but did not live it, killing a lion with his bare hands and eating from the honey in its corpse, and giving away the secret of his strength - long, never-cut hair. Samuel (1 Sam 1:11) and John the Baptist (Luke 1:15) also were made Nazirites from birth, or at least had elements of the vow upon them.
The Nazirite was an ascetic, but not a monk, being fully active in society. There are similarities to being a priest, who were also set apart to the Lord and could not drink wine in the temple. The high priest couldn't touch any dead body and his headdress was significant.
The growth of hair marks time, and was considered a symbol of one's vitality, so cutting it all off was a way to devote a set time of your life to God. This appears to have been a cultural practice, which God regulates and ties to the tabernacle.
In application, private pietistic activity ought to be linked with the public worship of God among His people as led by His representative (in OT, the priest). It is wise to consult and advise your pastor when "going beyond" regular prayer and fasting. Make known how God is at work in your life so we can all benefit, or so you can be guided or corrected.