An alien prisoner called Boris the Animal escapes prison and sets his sights on vengeance for Kay, who arrested and imprisoned him as a young MIB agent. While in prison, Boris learns where he can travel through time from a fellow prisoner whose son runs the shop in NYC (and as far as anyone can tell they are both human). He plans to go back in time to kill young Kay (Josh Brolin) and lead an invasion on Earth in the present.
In order to stop Kay from being killed as a young agent by future Boris, Jay (Will Smith) time travels back to 7/15/69, the day before future Boris lands.
The investigation leads them to an Arcadian alien named Griffin. He reveals that a system known as the Arcadian Net (or Arc Net for short) will protect Earth from the invasion of Boris's race (and eventually lead to its extinction). The only way to activate the Arc Net is to get it just outside of Earth's atmosphere. This can be conveniently accomplished by attaching the Arc Net to the top of the Apollo 11 rocket. That way, when the rocket breaks apart after breaching the stratosphere, the Arc Net will activate.
Future Boris lands and plots the scheme out with his younger self. At the launch site, Jay and Kay are arrested by the Army soldiers patrolling the area, but are set free when Colonel Edwards is shown the future by Griffin (whose race is able to see all possible futures and can show these futures to anyone he touches).
While Kay has his regular confrontation with young Boris, Jay keeps future Boris at bay. Jay uses the time machine to jump back a few minutes, allowing him to predict Boris's moves. Jay kicks Boris down to the rocket's base, where he is incinerated when the rocket launches. Kay shoot off past Boris's arm, causing him to fall to the ground, enabling Kay to attach the Arc Net to the top of the rocket. The rocket takes off, and as Kay gets back to meet Col. Edwards, Boris kills him. Boris taunts Kay to arrest him, but Kay takes Jay's advice and kills Boris, preventing the possible future where he destroys Earth. Behind Col. Edwards, a young boy gets out of a car and asks where his dad is. Rather than tell the boy the truth that his father was murdered by an alien megalomaniac, Kay neuralizes young James (who will be recruited as an MIB agent in 29 years). Kay tells the by his father was a hero, and Jay understands why he was told not to ask questions to which he would not want to hear the answers.
Jay returns to the future as he remembered it, and meets Kay for pie at their favorite restaurant. Though Kay realizes that Jay now knows the truth, he does not press the issue, and maintains his persona non grata attitude.
The world safe once again.