The Theft of the Time Stone was a plan executed by the Avengers as a part of their Time Heist. Hulk was sent to steal the Stone from Doctor Strange at the New York Sanctum. However, he was unaware that the Battle of New York predated Strange's tenure as Master and that the Sorcerer Supreme at this time was the Ancient One.
The Ancient One initially refused to relinquish the stone, citing that the Masters of the Mystic Arts would need the Time Stone to defend themselves in the future, although she relented after discovering that Strange had intentionally given up the Time Stone to Thanos and realized he had a reason for doing so.
The Avengers, who had discovered that they could use the Quantum Realm and Tony Stark's Time-Space GPS to travel through time and space, hatched a Time Heist, in which they would travel to the past and amass the six Infinity Stones in order to undo the Snap. Ant-Man, Iron Man, Hulk, and Captain America were tasked with going back in time to May 4, 2012, during the Battle of New York, to retrieve the Mind Stone, Space Stone, and Time Stone as half of the six Infinity Stones were in New York City on that day.
Upon arriving at the New York Sanctum, Hulk was instead met by the Ancient One, who informed Hulk that Strange was not yet a Master of the Mystic Arts and would not join them for five years, telling him that Strange was still currently a neurosurgeon. Hulk implored the Ancient One to relinquish Time Stone to him, notifying her of the Snap that Thanos caused in the future.
The Ancient One refused to give up the Time Stone for the Hulk, citing that she could not alter his timeline and leave hers undefended, despite Hulk promising that he would return the stone to her at the exact moment it was taken. The Ancient One proclaimed that all the Masters of the Mystic Arts have sworn an oath to guard the Time Stone as their chief weapon. But Banner, not wanting to give up, asks her why Strange had willingly relinquished the Time Stone to the Mad Titan. The Ancient One is then shocked realizing that Strange would only have given up the stone to Thanos for a good reason, the Ancient One decided to trust in her future successor, handing over the Time Stone to Hulk.
The Time Stone was placed within the Nano Gauntlet, created by Tony Stark, Hulk and Rocket Raccoon. Following the Battle of Earth, the Time Stone was placed in a suitcase and given to Steve Rogers, who traveled back in time once again to return the stone. By returning the Time Stone to the Ancient One, the Avengers ensured that the alternate timeline would be able to defend itself from Kaecilius and Dormammu in the future.