Are you referring to a specific mission or game mods?
Usually your commander can construct factories - each game the first factory built is free and completed instantly. Examples:
Factories can produce units, including builders that construct new structures. These builders are essential, especially if your commander died. Examples:
If you played other RTS games before: Think of your commander as a builder with high hp and a weapon. Factories are structures that build units. Some of these units are "regular" builders.