Farid Essebar appeared in front of a judge in Rabat's criminal court on Tuesday after being arrested on 25 August by Moroccan police at the behest of the US Federal Bureau of Investigation.
Moroccan police said the FBI had traced the origins of the "Zotob" virus to a Moroccan website.
"My client did not develop the Zotob virus but did participate in the creation of a worm that infected computer systems," lawyer Mohamed Sertate said.
Zotob allowed its creators to control infected computers from afar and prevented the machines' owners from accessing anti-virus websites.
The television channels CNN International and ABC News, the New York Times newspaper, computer giant Microsoft and the San Francisco airport were among Zotob's victims.
Sertate said that a Turkish national and not his client, was responsible for the creation of the virus.
A 23-year-old Turkish suspect known as Attila E was also arrested on 25 August in southern Turkey after a month-long manhunt requested by the FBI.
According to American software maker Symantec, the Zotob virus was able to breach security systems in Windows 95, 98, ME, NT, 2000 and XP operating systems.
The maximum sentence for computer piracy in Morocco is five years in prison.