Abdelfattah Raydi, 23, detonated a belt of explosives he was carrying after a tussle with the owner of the cafe in a suburb that is home to a large slum.
Al-Nass daily newspaper, which is considered to be well-informed on security matters, reported: "Five young men recruited by a man in the area of Hay Mohammedi were ready to carry out suicide bombings in Casablanca."
Al-Sabah newspaper said the blast was accidental. The real target had been Casablanca's police and paramilitary headquarters, restaurants and hotels, the paper said, citing unnamed security agencies.
A young man, identified by police as Youssef Khoudri and one of the wounded four, attempted to flee the scene of the explosion but was arrested four kilometres away. He too was wearing a belt of explosives, Moroccan sources have said.
Morocco has said it had information about an al-Qaeda plot to mount an attack, but that the circumstances of the latest blast were not clear.
North African governments fear violence may spill over from Algeria after the Salafist Group for Preaching and Combat renamed itself al-Qaeda Organisation in the Islamic Maghreb with the aim of fusing similar groups together.
Last week, security sources said police had arrested Saad Houssaini, the head of the military wing of the Moroccan Islamic Combatant Group (MICG).
Police suspect him of being involved in the 2003 Casablanca bombings and the 2004 Madrid bombings, and security experts believe the MICG is one of the militant factions to have joined the larger al-Qaeda group.