As per Abridged version of Vamana Purana by International Gita Society (IGS), Lord Shiva and Lord Vishnu had to exchange their weapons to kill a demon named Jalodbhav. Here is the complete story (the text in  added by me to clarify):
Narada was surprised and asked Pulastya why Lord Shiva and Lord Vishnu had held Sudarshan chakra and trident respectively. Pulastya explained- "During ancient times, there was a mighty demon king named Jalodbhav. He had pleased Lord Brahma by his severe penance and was blessed by him to become immortal [can only be killed in very rare scenario when Shiva attacks with Chakra and Vishnu attacks with Trishula]. After receiving the boon, Jalodbhav became arrogant and started tormenting the deities and the sages. The deities sought the refuge of Lord Vishnu. They accompanied Lord Vishnu to Himalaya Mountain to meet Lord Shiva. Lord Vishnu and Lord Shiva exchanged their weapons. Both of them went to kill the demon who on seeing them got scared and hid in a nearby river. Lord Vishnu and Lord Shiva waited eagerly for him on the opposite banks of the river."
"After sometime, Jalodbhav came out of the river thinking that both of them must have departed by now. He climbed up the Himalaya Mountain and both the deities chased him. Lord Shiva attacked him with his chakra while Lord Vishnu pierced his trident in his chest. Jalodbhav died and fell down from the Himalaya Mountain." After finishing his story, Pulastya says- "This was the reason why both Lord Vishnu and Lord Shankar had exchanged their weapons.
So after this incident, Vishnu would have given (returned) trishula/trident to Shiva.