In this book, Diamond does not specifically address the issue of why guns were invented. He does not dwell on the actual invention of guns. Instead, he merely talks about inventions more generally.
Diamond argues that there are inventive people and people who are less inventive. They are scattered randomly around the world. However, he argues, those in Western Europe (the people who invented guns) came to invent more things than others. He gives at least two possible reasons for this.
First, the people in Western Europe had the benefit of agriculture for a longer time. Diamond argues that people who get agriculture earlier have a longer time in dense communities where innovation is more likely to occur. Second, the people in Western Europe were constantly in competition with one another. Diamond argues that this is why they became technologically more advanced than those in China. He says that the Chinese did not have to compete much with surrounding countries. By contrast, the Western Europeans were constantly trying to find ways to get ahead of one another. These two reasons account for why they invented guns while other peoples in the world did not.
they were invented for violence and to kill people in wars and also for soldiers