This is an excellent question with no easy answer.
Drosophila is one model organism for which we know something about how expression of specific genes leads to developmental structure [1] but there is a lot still unknown, not just for
Drosophila but also for cellular differentiation [2] more generally.
[1]: https://en.wikipedia.org/wiki/Drosophila_embryogenesis
[2]: https://en.wikipedia.org/wiki/Cellular_differentiation