They deny charges of aiding a “terrorist group” and being in Kenya illegally.
The court heard testimony from a guard who was outside the centre when the gunmen launched the attack in September, killing at least 67 people.
Somalia’s al-Qaeda-linked al-Shabab group said one of its suicide brigades carried out the siege.
The four are the first to be charged over the attack – the worst in Kenya since 224 people were killed in the 1998 bombing of the US embassy.
None of the men – named as Mohammed Ahmed Abdi, Liban Abdullah, Adnan Ibrahim and Hussein Hassan – are accused of being the gunmen who carried out the attack.
Their nationalities have not been disclosed, but they are said to be ethnic Somalis.
Guard Stephen Juma told the court he was directing traffic outside the upmarket shopping centre when a car pulled up and three men jumped out, the AFP news agency reports.
He did not see their faces, but heard gunshots, Mr Juma added.
“I made a radio call for help while running to the main entrance,” Mr Juma is quoted as saying.
“I took shelter in a residential compound until when I saw policemen come.”
The police say the four accused had sheltered the attackers in their homes in Eastleigh – a Somali neighbourhood in Nairobi – and that they were in contact with the gunmen four days before the siege.
All four have pleaded not guilty to the charges, which includes obtaining false identification documents.
The Kenyan army has said that all four of the attackers died during the siege.
One of the suspected attackers has been named as 23-year-old Somalia-born Norwegian national, Hassan Abdi Dhuhulow.
Al-Shabab is fighting for an Islamic state in Somalia.
It said it carried out the attack to avenge the presence of Kenyan troops in Somalia to bolster the UN-back central government.