According to police, the truck, which was travelling to England from Poland, was going through customs at the Loon-Plage ferry terminal when there was an "explosion" in the trailer.
Emergency services were called at around 7pm but by the time fire fighters had arrived the flames had already engulfed the vehicle.
When examining the remains of the vehicle fire fighters then discovered the bodies of two men, presumed to be illegal migrants, who have not yet been identified.
The position of the bodies suggests that the victims tried unsuccessfully to escape after the explosion, according to local newspaper La Voix du Nord.
The Polish driver of the vehicle is said to be in a state of shock. He will be interviewed by investigators.
The incident highlights the risks the thousands of migrants camped out in northern France are prepared to take in their quest to make it to the UK.
Around 2,500 are believed to be massed in Calais, which is the main port that serves the UK.