This post will contain spoilers about the movie and the comics. If you don't want to be spoiled, stop reading.
Avengers: Infinity War is the first part of a capstone movie meant to be the culmination of all the Marvel Movies to date. The plot of this particular movie is roughly taken from a series of comics, "Infinity Gauntlet" from 1991.
There are a number of differences between the movie and the comic series (for better or for worse):
In the movie, Thanos is motivated by some twisted sense of preservation of the universe. Having experienced the downfall of his own people (which he attributes to over population), he believes that the same fate will befall the rest of the universe unless the population is significantly culled. Deciding upon a 50% reduction he goes about this the hard way, manually halving all of the populations he comes across. At some point he realizes he needs a better way, any decides to capture the Infinity Stones to achieve this. His acquisition of the stones is the underlying impetus for the plots of Avengers and Guardians of the Galaxy, and the stones themselves feature significantly in almost all of the MCU Films save Black Panther, Ant Man (1 & 2), and Spiderman: Homecoming.
In the comics, Thanos actually doesn't give two shits about halving the population of the Universe; Death does. In the comics, Death is an actual being, death personified. She is angered that there are more living beings than dead, and seeks to even the scales. To this end she resurrects and empowers Thanos (who is in love and infatuated with her) to enact her will. Through trickery, Thanos convinces Death that he needs the infinity stones to accomplish this task, and she assists him in collecting them. He has to be reminded of his part of the deal (by his lackey, Mephisto) and only performs "the snap" as an afterthought, thinking that by holding up his side of the bargain, he will earn Death's affection.
Ultimately, I think this was a good move. Thanos' obsession with death is something that might play in the comics, but would be just a bit too silly on the big screen. It also eliminates having in introduce a new character, a cosmic being at that, and avoids any confusion with Death and Hela, Asgardian Goddess of Death. His plan in the movie is a bit more sensible (even if it has his flaws) whereas his goals in the comics are somewhat undefined.
Timeline of Events
Infinity War has been building for quite a while, with the gems appearing predominantly, and Thanos waiting patiently in the background. Only after repeated failures does he decide to enter the game himself, forcibly taking the gems and - only after protracted resistance - is he able to perform "the snap."
In the comics, Thanos' acquisition of the gems is a plot in its own right (Thanos Quest) and he goes around, personally taking them from various beings. The main plot (Infinity Gauntlet) starts with him in possession of all of the gems, and almost no one is even aware of this until after the "the snap". After culling half the population, then the protracted resistance begins, as Earth's assembled heroes attempt to take back the gauntlet.
In the movies, the heroes assemble at a number of points to try to prevent Thanos from getting the gems and to take back the gems he has already acquired. In the comics, they can only hope to kill or seize control over the gems, as he already has them all by the time anyone is aware. In both cases, Resistance is Futile, and Thanos easily dispatches them. The main difference is, in the comics, the heroes are acting under the direction of one Adam Warlock, who acknowledges that the fight is merely a distraction while more powerful beings (cosmic entities) muster in an attempt to launch their own attack.