That could be a factor, but it's not the only factor. You can look this up at various sources on your own, but in layman's terms: when you get the vaccine your body recognizes the invader and sends several things to the site to (1) investigate it and (2) start to an initial fight against it (which it will refine as it learns more). This immune response can cause inflammation, and thus arm soreness. Also, this article points out that the arm muscle could be sore just simply from the small trauma of having the needle separate muscle fibers on a very small scale.
This article is specifically about the COVID vaccine, but the concept is similar for many vaccines.
https://www.google.com/amp/s/www.wc...-fix/275-0a93e514-e922-4861-8d7a-0675fd83761b