Iron Man knew all about Spider-Man in Captain America: Civil War despite the character not appearing in previous films. The truth of it is that Sony and Disney reached a somewhat unexpected deal which allowed Peter Parker to appear in the Marvel Cinematic Universe. The MCU had already fleshed out a lot of New York City and its world without any mention of the wallcrawler (save for one possible call out in Ant-Man) so he added to be shoehorned in for the first appearance in Captain America: Civil War. Not much explaining went into how Tony Stark suddenly knew about Spider-Man -- until now. The Wakanda Files, a book which contains MCU canon facts and secrets, reveal Tony Stark's personal log of learning about Spider-Man.
"This kid in Queens that's blowing up on YouTube is a bit more interesting than a cat playing a harmonica," Stark writes. "Get this. Some teenager gets bit by a spider and suddenly shows up some of the beset in the Avengers squad? And I don't think these are special effects: this kid is catching an im-motion vehicle traveling at 45 milers per hour. That's like 3,000 pounds worth of vehicle. How?"
So, as it turns out, YouTube is the source of Tony Stark's discovery. This was hinted at in Captain America: Civil War.
"He's created this webbing from what? Over-the-counter products he's buying in a bodega?" Stark goes on. "If he created all of this tech scarping together garbage, think what he could do with the playground we've built upstate." Sadly, Tony didn't live long enough to see Peter Parker make great use of all the tech he provided as he did in Spider-Man: Far From Home. Peter finally designed his own upgraded suit before the film came to an end, using Tony's technology aboard one of the Stark Industries jet planes.
Back when Captain America: Civil War was coming out, ComicBook.com posed the question of how Iron Man knew about Peter to Tony Stark himself Robert Downey Jr..
"I embrace it, tell me everything I don't know," Downey joked when he did not have the exact answer in the moment. "Tony is essentially pretty broken and narcissistic and over the course of all these movies he's kind of making up for that and trying to heal and become a better person."
Captain America: Civil War co-director Anthony Russo took the lead on the question. "In our minds, we're picking up Peter Parker's story at a point after which he has gotten his powers," Russo said.. "In our storytelling, he has been doing some things in New York and there have been Sasquatch-like videos of what he's been doing that's been showing up. You've heard word of mouth about things that have been happening, there's this very strange thing happening, so it's kind like a rumor mill that nobody's been able to identify what's been happening or how it's happening. Of course, Tony Stark being who Tony Stark is, he's one step ahead of everybody else."