User blog comment:MarvelFan2012/Questions and Answers about Spider-Man/@comment-5354189-20120805110353/@comment-5111260-20120805172925

It was all depicted in a one-shot comic called Spider-Man 2099 Meets Spider-Man. It was revealed that it was caused by an temporal anomaly which caused a rift in their timelines, which somehow made them switch places. It was because that Fujikawa (of the Modern Age) and Alchemax  were both experimenting on a temporal energy generator.

They soon found that the cause of all this was a time travelling Hobgoblin from 2211, but with the help of the Spider-Man from 2211, they defeated the threat and were all sent back to their original timelines.

I'm sure that Peter reacted with surprise and shock when everything happened.