The fire at 22270 Montgomery St. was reported shortly before 3:15 a.m., Hayward fire Capt. LaShon Earnest said.
Firefighters arriving on the scene found six cars engulfed in flames, Earnest said.
The fire was contained within 10 minutes without any damage to the carport structure. However, the six cars were completely destroyed and two others sustained damage, Earnest said.
No one was injured in the blaze.
A man described as being around 40 years old was involved in an altercation at the scene and was punched by one of the apartment building's residents, Earnest said.
Investigators later determined that the resident had spotted the man allegedly starting the fire by trying to siphon gas out of one of the cars. The fire started when the man, whose name was not immediately available, lit a cigarette during the siphoning process, Earnest said.
The man who was allegedly siphoning gas was taken into custody, Earnest said. He was taken to Eden Medical Center for injuries suffered in the fight but was not seriously wounded.