This is not an official Star Trek answer, but it is too long for a comment.
The reason not all personnel are armed is due to several "real world" reasons.
First, I am unsure if all ST personnel are required to take fire arms qualifications during their training, but in today's military they are... but I would not trust a good chunk of them with a weapon, given their primary occupation. While they may have used the weapons at some point and been trained, they would have "lost their edge" after spending time learning/preparing for their "actual" job and even less time after they began their "actual" job. This would result in a decreased reaction time using the weapons and possibly even forgetting how to handle weapons cleaning, malfunctions, etc.
Tagging off of this first fact is the point of the actual teams dedicated to ship security. The security teams did have weapons training are assuredly running training and tests everyday to prepare themselves in the event the ship is boarded. They are trained, work well as a team, and are ready to carry out specific defensive measures that are aligned to a specific purpose (i.e. coordinating ship sweeps that push the intruders to a corner or non-essential area). Working in the galley, engineering, etc. every day would not allow the rest of the crew to participate in those training sessions. This would cause them to be unreliable and potentially a liability should the situation actually happen.
Without the training and comfort of handling weaponry everyday there is also the higher risk of what is called "blue on blue" fire; this is when you fire on your own people... I have had it happen to me and it is scary as hell. Even people who go hunting end up in the emergency room because they shot their buddy; it is a higher risk when you know someone else is gonna shoot back at you and you are scared for your life.
There are potentially other reasons for this, but these will hopefully get the point across. It is the same concept as why not give everyone a gun in America to defend against active shooters? The only way to stop a bad guy with a gun is a good guy with a gun right? we hear that all the time... and while that works in theory, in reality it would not work that way.
Edit: I realized I completely forgot to acknowledge your second question. This is much more straight forward however. The reason they did not consider themselves a military vessel is because they were not a military organization. Star Fleet was about exploration, nothing more. It also bodes well for future contact if you say you are an explorer as opposed to a military might. It takes away some of the tension, not all but some. And as will all explorations you still can bring guns with you when you explore. It is a mindset that you want your organization to have for both themselves and that they present to anyone else you meet. You are not there to cause trouble, but you will defend yourself if provoked.