Apart from an injury to your neck or poor posture which can strain your muscles, it’s quite uncommon to have chronic pain in your neck.
However the pain could also be from a herniated disk or degeneration of the joints in your upper spine as a result of osteoarthritis or loss of bone mass (osteoporosis).
Disks between bones in your neck can thin and lose elasticity. Bony outgrowths (spurs) can also form and cause pain. I have one which is shaped like a beak and is trying to fuse itself into my spine
but my metal work is in its way. My consultant said that once it has fused into my spine the pain will go away. As for how long that could take is anyone’s guess.
Also as joints rub together with greater than normal force surfaces where they meet become irregular which can also cause pain.