It could be the different handlebars. Let your arms hang comfortably then bend up 90 degrees at the elbow, note your hand orientation is similar to how you would ride the hoods on a drop bar. With flat bars you have to rotate your hands, this can cause shoulder issues. My wife was experiencing this to the point of getting medical treatment and PT. The therapist pointed this out. We got her a drop bar bike and the issue is much improved.
Obviously lots of people ride MTBs so you might just need to condition yourself. Try doing "yes no maybe" neck stretches and shoulder shrug exercises. I will occasionally get neck and between shoulder pain while riding my road bike, I can do a set of the YNMs while waiting at a traffic light. Almost immediate relief.