Well that is easy: very, very slowly.
Let's say a species of bug tends to live in a particular type of tree. Within the population (gene pool) of this species, there are slight variations in color and shape. Those which are the closest in color to the tree tend to get eaten less often, so they get to reproduce more, thus producing more of the "tree colored" bugs, which eventually comes to dominate the gene pool. At the same time, those which might have a *slightly* leaf-like shape are likely to get eaten less than those without this shape, reproducing more, etc. This effect continues and continues as those with more camoflauging characteristics (little by little) live more and reproduce more. In evolutionary terms the non-camoflauged ones are "selected out". Given enough time and enough "selection pressures" (being eaten if not camoflauged, for instance), this is bound to happen. This is known as "natural selection", the primary mechanism for evolution.
Every now and then this whole process can be accelerated with a genetic mutation (not mutation in the monster mutant sense, just an unexpected variation in the genes which can control things like color or shape). These happen all the time, but are usually nuetral (having no effect on morphology), and sometimes harmful (meaning the mutation will cause more harm than any good it may do and will eventually be "selected out"). But occasionally (and when we are talking thousands of generations in a gene pool over hundreds of thousands of years, this can happen more often than one would expect), a mutation creates a feature that happens to be very useful and if this one bug reproduces enough, this new feature will help those bugs survive more often and (you see where I am going now), it will eventually come to dominate the gene pool and become a feature of the population. So, in our case, let's say some particularly "leafy" trait was caused by a mutation, this would be passed along and, since it is very camoflauging, it would eventually lead to all of population having it.
An initial reaction is "well, how conveenient that a mutation came along that did exactly what was needed" and want to insert supernatural in at this point (the ever dangerous "God of the Gaps" trap). But really, this is not necessary since there is something that can easily be overlooked: those species that survive are those which DO have these processes happen in the right way, at the right time and quickly enough (in the slow, evolutionary meaning of "quick"). Over the course of the history of the planet, we have had vastly more species die out than have survived.
Another factor that can come into play is genetic drift. This is when one or a group of bugs from one population crosses over into the other. Now we have two sets of features, which allows the population to "select" among them for the ones that will help it live long enough to reproduce more often, thus possibly causing a more rapid change than would occur otherwise.
Now, keep in mind that this process is all so well documented, and even observed, that even the Creation Scientists have accepted all these mechanics in full (they just call it micro evolution, as distinguished from macro evolution). In fact, they NEED these mechanics of evolution to explain how we have SO many varieties of species (vastly more than can have been on the Ark). They just say it happened REAL fast (which can't really be true for a variety of reasons, but that's what they say).
So, your bug there was, almost assuredly, not on the Ark and did not exist at the time of the proposed global flood (they couldn't all be, after all). What I just explained above is the way both Creation Scientists and secular scientists say it would have happened, and it is evolution.
Where the Creation Scientists draw the line is by saying that micro evolution can not continue to make changes that would eventually lead to macro changes. They have not come up with a solid reason why NOT, though. And all the evidence points to the fact that it can, indeed, lead to macro changes.