In a young person like you, it might be because of cervical muscles spasm (most common). However other reasons like cervical spondylitis, systemic disease etc should be ruled out.
Careful history taking and examination is necessary.
Next Steps
consult a pain management specialist for proper work up and management.