Did Vikings use hammers as a primary weapon? Does Thor being associated with a hammer has something to do with it?
No, Vikings primarily used axes and swords in battle along with bows and crossbows, with hammers being extremely rare. In Norse mythology, Thor is given his hammer due to the fact that he is the god of thunder and lightning, which is how he supposedly made these natural phenomena. Thor was also the god of smithing, not war, and so he used his hammer in mythological battles because of this, not due it being a common weapon in Viking armies.