The Crown alleged they paid the gang up to £10,000 each to be brought across the Channel to secure a better life in Britain.
But they were kept for at least 12 hours “with no means of escape and no means of communication with the outside world”. He said the desperate migrants had no phone signal.
The bodies were found by Maurice Robinson, a lorry driver paid to pick up the container at Purfleet, Essex, and give the migrants some air.
Mr Emlyn Jones said: “Robinson drove out of Purfleet port and almost immediately stopped and opened the doors at the back. What he found must haunt him still. For the 39 men and women inside, that lorry had become their tomb.”
Another lorry driver, Eamonn Harrison, is said to have driven them to Zeebrugge, Belgium, for loading on to the Purfleet-bound cargo ship. Harrison, 23, of Mayobridge, Co Down, and Gheorghe Nica, 43, of Basildon, Essex, deny 39 counts of manslaughter.
Nica has admitted conspiracy to assist unlawful immigration – a charge denied by Harrison, Valentin Calota, 37, of Birmingham, and Christopher Kennedy, 24, of Co Armagh.
The court heard Robinson and haulage boss Ronan Hughes had pleaded guilty to the manslaughters and the people-smuggling plot.
Mr Emlyn Jones said the horror unfolded on October 22 last year when the 39 were loaded into the lorry in northern Europe. He said Nica was a “key player” and on the day after the landing was “primed” to meet the cargo.
The trial continues.