Well, it depends on what chip it is
As you can imagine a NOT gate will not have the same thing or quantity as a microcontroller. Still, they use the same thing inside: transistors. miniaturised, fast, and a shedload of them.
you can, with enough knowledge and patience make your own MCU from transistors (or logic gate ICs). it won't be as small as the real thing, though.
the first computer programs were written on punch cards. Or wait, no, there was Babbage's analytical engine and Ada Lovelace. Check those topics out.