>>38711884In most series, Transformers technically aren't even robots. They're a race of pure energy that run around in robot suits so they can better perceive and interact with the world. Here's a baby Transformer with its energy ball exposed, before its body takes on its final form and alternate mode.
The typical way that Transformers add to their population is through their energy race's god, either via it directly pooping out new soul balls or it acting through a godly artifact that poops out the energy.
The reason this god made a species of smaller beings in shape changing robot bodies, again, depends on which series you're looking at. Sometimes it's just to explore the universe through the eyes of its children. Sometimes it's to create an army to fight against the god's evil alternate. Whatever the case, this race tends to start civil wars with itself.