Peter gets on board bad guy's ship trying to help Iron Man:
Traveling to Titan:
Finds a symbiote on board in a lab somewhere that Thanos' henchman was experimenting with:
Symbiote escapes or Peter releases it and it immediately sees him as a way to freedom:
Before Peter can process what has happened the ship crashes on Titan. In the middle of the fight with Thanos his aggression goes through the roof, and good thing too because you get the feeling he wouldn't survive the battle otherwise:
Things still play out as they do though. Peter gets dusted only to be revived and returned to Earth. Then during the battle we see him starting to enjoy how the sybiote is making him feel:
Thus setting the stage for his next solo outing which would have explored the symbiote storyline, had Hardy as Eddie as part of it and then in MCU Spidey 3 we get Hardy as the newly bonded Venom out to get Peter: