In prokaryotes microorganisms, there is a structure called a plasmid.
Plasmids are, by definition, extrachromosomal circular DNA strands with the ability to replicate themselves autonomously.
This structure can also be transmitted independently from DNA. Not only from "parent cells" to "daughter cells" through mitosis but they can also be transmitted between microorganisms even if they are not necessarily from the same type of bacteria.
Why is this important? Bacterias may receive DNA from other types of bacteria that can be beneficial for them, one example is the genes that produce resistance to certain antibiotics. Microorganisms from the same genre but different species may develop resistance to the same type of antibiotic due to gene transmission through plasmids that are transferred from cell to cell.
Scientists use their knowledge of genetics to isolate the gene that produces human DNA, then they remove a plasmid from the bacteria, include the insulin gene into the plasmid's DNA strain and then they return the plasmid into the bacteria.
Now they have a recombinant bacteria that is capable of expressing the gene for human insulin. Remember that this is possible because the plasmid is autonomous and can express its genes independently of the microorganism's processes.
The bacteria is nurtured in a fermentation tank where it produces insulin that is later harvested and prepared for people's use.