The injured included two children and a police detective, who killed the man after being slashed with the machete, the New Straits Times reported.
The victims, aged between two and 48, were admitted to a hospital.
No reason was given for the mans two-hour rampage in the Menggatal area of the town in Sabah state on Borneo island, but he was found to be carrying documents in two different names, the paper said.
Thousands of Filipinos have been deported from Sabah in recent months in a crackdown on illegal immigrants which has provoked complaints from Manila that its citizens have been badly treated in detention camps.