You need to complete the "Steam technology" quest in order to unlock the Factory building. Builduing a Factory allows training heavy units.
To pass the quest you need to click on the Clock Tower and complete all the requirements.
If the frame around a building is gray it means that the task is not completed yet.
You need to assemble all the constructions in order to complete the quest.
Regards, Nexters Support Team