Factories were first developed in Britain but quickly spread to other countries as well. They were developed in areas where there was need for a large amount of products for a large population and high amounts of exporting and Britain was the prime market for this since it had colonized a huge part of the world and it was great for earning money.
The first industry was the textile industry. One of the oldest factories, if not the oldest was the Lombe's water-powered silk mill at Derby which was operational by 1721. Another factory was opened soon after that dealt with brass, but with the development of the spinning Jenny textile became the prime industry for factories worldwide.
The industrial revolution earned a huge amount of wealth for Britain and it invested the money into science and this led to a scientific revolution. New medicine was found which completely destroyed numerous diseases at the time and people finally started understanding how important cleanliness was. Sanitation and clean equipment and washing hands and similar things became a priority and people started falling ill less often and their life spans were increased on average.