Factorio has been around for ages, but with the recent Spage Age DLC and a new update, many basic commands are different than we're used to, including the ability to switch weapons.
69 New Features and Mechanics in Factorio 2.0 SPACE AGE
Initially, you would switch weapons with TAB or Q. However, for some reason the developers of Factorio decided to change the default button layout for switching weapons and other buttons with the recent DLC. This obviously led to some frustration for players who had learned the original key bindings through muscle memory, but luckily there is a way to change your weapon key back to what it was if you don’t like the new changes.
How can you change weapons now?
To switch weapons, you now have to press the C key instead of TAB and Q. You can reset the settings in the controller keybind settings of the main menu if you want to return the controls to what they were.