In 1979, Deputy Sheriff Jack Lamb (Kyle Chandler) of Lillian, Ohio, and his 14-year-old son Joe (Joel Courtney), mourn the death of his mother Elizabeth (Caitriona Balfe) in a steel mill accident. Jack blames her co-worker, Louis Dainard (Ron Eldard), as she was covering his shift while he recovered from a hangover, and all Joe has left is a locket that belonged to her, that he now holds on to.
Four months later, Joe's best friend Charles Kaznyk (Riley Griffiths) decides to make a low-budget zombie movie for an international film competition. Charles enlists the help of Preston Scott (Zach Mills), Martin Read (Gabriel Basso), and Cary McCarthy (Ryan Lee), as well as Dainard's daughter, Alice (Elle Fanning). Though their fathers would be furious, Joe and Alice become infatuated with each other.
Charles has them film a scene at a train depot at midnight. While they are rehearsing, a train approaches, and Charles has them start filming as the train passes to add 'production value'. While filming, Joe witnesses a pickup truck drive onto the tracks and ram the train, causing a massive derailment that destroys the train, the depot and the surrounding area, and the friends barely survive. The children investigate the wreck and find crates full of strange white cubes, then discover the truck's driver is Dr. Woodward (Glynn Turman), their biology teacher. Woodward, barely alive, warns them at gunpoint to forget what they saw that night, or else they and their parents will be killed. The children flee the scene just as a convoy from the local U.S. Air Force base, led by Col. Nelec (Noah Emmerich), arrive at the scene. Nelec discovers an empty Super 8mm film box, and assumes the event was purposely captured on camera.
While Joe and Charles wait for their film to be developed, the town experiences strange events: All the dogs run away, several townspeople go missing, the electrical power fluctuates and electronic items from all over are stolen. Overhearing military communications, Jack approaches Nelec to address the rising panic in town, but Nelec instead orders him arrested. Nelec orders the use of flamethrowers to start wildfires outside of town, as an excuse to evacuate people to the base. Suddenly, soldiers sweep into town to begin the evacuation. Meanwhile, Joe and Charles watch the derailment footage and discover that a large creature escaped from the train.
At the base, Joe learns from Alice's father that she is missing, abducted by the creature. Joe, Charles, Martin, and Cary convince Jen, Charles' older sister, to pretend to hit on Donny (a worker at the camera shop) in order to get into town to rescue Alice. They break into Dr. Woodward's storage trailer and discover films and documents from his time as a government researcher.
They play the film, which reveals that an alien crash-landed in 1958. The Air Force captured the alien and was running experiments on it while keeping it from its ship. Woodward was one of the scientists experimenting on the ship, composed of the white cubes. At one point, the alien grabbed Woodward, apparently establishing a psychic connection with him. Now understanding the alien, he was compelled to rescue it and help it escape from Earth. He found out about the train, years later, and sought the opportunity to help the creature. The boys are caught by Nelec, but as they are taken back to base, the alien attacks their bus. The airmen are killed and the boys escape. Meanwhile, Jack escapes from the base's brig and makes his way to the shelter housing the townsfolk. He learns from Preston about Joe's plan to rescue Alice. Jack and Dainard then agree to put aside their differences to save their kids, making amends along the way.
In town, their hardware malfunctions as the military attempts to kill the alien. Martin is injured in an explosion, so Charles stays behind with him while Joe and Cary head to the cemetery, where Joe had earlier seen something there that made him suspicious. Inside the cemetery's garage, they find a massive tunnel leading to a warren of underground caverns. In a chamber beneath the town's water tower, they find the alien has created a device from the town's stolen electronics, that it appears to be trying to fully activate, attached to the base of the tower. The alien also has several people, including Alice, hanging from the ceiling and unconscious, that it uses for food. Using Cary's firecrackers as a distraction, Joe frees Alice and the others, but they end up trapped in a dead end cavern after the alien chases them down and eats the others. Alice and Cary scream and cower against the tunnel wall, but Joe steps forward and tries to talk to the alien. The alien grabs Joe, who quietly speaks to the alien, telling him over and over that "bad things happen" but that the alien "can still live". After studying Joe for a moment, and then hearing its device fully activating, the alien releases him and departs, allowing the three to return to the surface.
As Joe and Alice reunite with their fathers, everyone watches as various metal objects from all over town are magnetically pulled to the top of the water tower. The white cubes are also pulled in to assemble into the alien's spaceship, using the objects and the water tower as its base. As it nears completion, the alien enters the spaceship. The locket is then drawn from Joe's pocket towards the tower and Joe, after a brief moment, decides to let it go, completing the ship. The water tank implodes and as the tower legs fall a safe distance away into the street, the ship rockets into space. Joe takes Alice's hand as they watch the ship depart into the night sky.
During the credits, the kids' completed film, entitled The Case, is shown.

Question: Why were the teens at the site of the train crash?
Answer: they were filming a scene