Director Michael Bay didn't like the script and often engaged Will Smith and Martin Lawrence in discussions about how the dialogue and scenes could improve. He often allowed them to improvise while the camera were rolling. He secretly told Will to call Lawrence a bitch before the car-scene. The whole "two bitches in the sea" was improvised, as was Martin's comment when Téa Leoni called him gay.
According to Michael Bay, Sony bought the rights to the script from Disney for $3 million. Martin Lawrence had signed on at that point, and the studio wanted to team him with Arsenio Hall. Bay decided to replace Hall with Will Smith after noticing the potential for Smith's star power from The Fresh Prince of Bel-Air (1990). Hall turned it down and cites that choice as the worst mistake he has ever made.
The opening scene where Mike and Marcus are held up by two carjackers was shot in Los Angeles weeks after principal photography had been completed. Columbia and Michael Bay wanted a better, more comedic introduction to the two lead characters than what was in the original film.