You may have muscle knots from tension. There are exercises to correct this. Pay attention to your sleeping position. Try ibuprofen. Get a friend to massage your neck, looking for knots to press. Go to YouTube looking for exercises for neck pain.
Get referred to a physical therapist if this doesn't resolve.
You have bruised it badly or twisted some muscles.
Keep your neck warm by wrapping a scarf around it. Take pain relief as prescribed.
If it does not start to settle after a few days, make an appointment with your doctor again so that you can be referred for physiotherapy.
Keep warm and stay out of draughts.
Wishing you a speedy recovery.