Upton Sinclair was a socialist who wrote The Jungle to raise sympathy for the plight of workers being exploited by the capitalist system in the late 19th and early 20th centuries in the United States, with a focus on immigrants. It is a type of art called polemic, that is meant to sway people emotionally.
The novel arose out of a specific event, the 1904 meat-packer union's strike, which was broken by the "big four" meat-packing companies. The novel was initially serialized in a periodical called Appeal to Reason, and was rejected by major publishers who found it too shocking and depressing to want to print. Sinclair published it himself and dedicated it to the working classes. He hoped, like many reformers of that time period (though he understood himself primarily as a novelist), to inspire the public at large to support worker protections that have become commonplace since , such as minimum wage and unemployment insurance, as well as to inspire the public to support unions. In the novel, just about every horror befalls the poor immigrants who are struggling to get ahead in this country: they sign a contract for a house in pursuit of the American Dream only to be foreclosed on because they didn't understand the fine print or the way the contract was weighted against them, they lose jobs, almost freeze when they can't afford fuel in the winter, get sick and are forced into prostitution.
But as others have noted, the horrors suffered by the workers paled against people's fears that they might be eating tainted meat. The novel may not have helped the cause of workers' rights but it did inspire legislation to regulate and inspect the meat-packing industry.