Why is 挺 used as measure word for machine guns?
挺，表数量，用于条状物。

As a measure word, 挺 refers to something that is long.

In《太平御览》卷八三五，it says 壶中大钱一千，以通九泉之路，蜡烛一挺，以照七尺之尸。

In modern Chinese, 一挺蜡烛 is no longer commonly used.