"We all started laughing," Twohill recalled.

Films about companies don't always work out the way their image handlers might hope. Producer Scott Rudin approached Facebook about participating in the 2010 film "The Social Network" but said he walked away because the company made too many creative demands. The movie won three Oscars, but Facebook founder Mark Zuckerberg was portrayed in an unflattering light.

Vaughn and Levy said they won Google over with a commitment to cast Google in the film essentially the way Google sees itself. Levy made a series of subsequent trips to Google in spring and early summer last year, meeting with Google employees and exploring the campus. He attended training for summer interns.

PHOTOS: The 20 best companies for interns

Levy, Vaughn and screenwriter Jared Stern say they were given wide latitude to interpret freely. Levy also promised that the PG-13 comedy, though irreverent and occasionally crass, would retain the warmth, humor and optimism of some of his other films, including "Night at the Museum" and "Cheaper by the Dozen."

"This was opportunity to take a lens inside of a culture that is globally ubiquitous but largely mysterious," said Levy. "Everyone knows Google, but no one knows what it would be like to work at Google."

The film showcases the famous perks that Google's rich profit margins make possible: free gourmet food and dry cleaning, nap pods for afternoon shut-eye, lap pools and volleyball courts.

In the script-writing phase, the company furnished "tech-speak notes" to lend authenticity to conversations between company interns. The filmmakers gave one tireless employee, played by Rose Byrne, a line that underscores the corporate philosophy of "Googleyness," a combination of intellectual curiosity and a passion to change the world.

"I actually believe," Byrne tells Wilson's mystified newcomer, "that what we do here helps make people's lives a little bit better."

"It wasn't a shallow comedy, it was a comedy with heart — that was very important," said Twohill. "It captured our spirit, or 'Googleyness.' They built a lot of trust with us."

PHOTOS: Google Doodles of 2013

Companies are increasingly leaping from the background in films into story lines and dialogue, said Sut Jhally, professor of communication at the University of Massachusetts at Amherst. "The Internship," he said, is just a step beyond what Levy did in "Night at the Museum," in which the American Museum of Natural History starred alongside Ben Stiller. "You don't have to do direct product placement anymore. ... The whole environment of the film is Google."

Vaughn says Google's driverless car and other products lent authenticity and aided in storytelling: They heralded the characters' entry into an unfamiliar world, much like the horse of a different color signaled Dorothy's arrival in Emerald City in "The Wizard of Oz."

Even though Google is happy with its portrayal, Jason Squire, an associate professor at the USC School of Cinematic Arts, said the film is still a risk — it could bomb at the box office or rub people the wrong way. "It's a very daring thing," he said. "It could easily backfire."

There were a few ideas that Google pushed back on, said Aasif Mandvi, who plays Roger Chetty, the gruff head of Google's internship program. For example, filmmakers had originally wanted the self-driving car to spin out of control and crash. "I think Google was like, 'No, we're not going to do that because we haven't even launched the driverless car yet,'" Mandvi said. "I don't think they wanted to show it in a way that was not favorable."

Twohill said she resisted the urge to meddle with other less flattering parts of the film that distort reality for comedic effect, such as the sometimes harsh treatment of interns (the program is referred to as "mental 'Hunger Games'"). Or one ribald "team building" excursion to a San Francisco strip club.

"We were a little bit worried about the dance club scene, to be honest," said Twohill, who watched the film with company founders Page and Brin. "I knew what was coming, they didn't."

Asked Page and Brin's reaction, Twohill laughed. "I'm still here," she said.

jessica.guynn@latimes.com

dawn.chmielewski@latimes.com

Oliver Gettell contributed to this report.