One (the discriminator) is trained with a bunch of images showing what beetles can look like. It detects a real or fake image of a beetle.
The other (the generator) is just generating images with a convolutional neural network. The generator optimizes itself based on how close it is to passing the discriminators test - that is its "loss function".
So over time, the generator gets better and better at making things that look like beetles. The process takes a very long time and is aided by many GPUs (as mentioned in the article)
The machine here doesn’t even know that those are beetles (because nobody told it), it is “just” arranging pixels in a similar manner as the pixels from the source images. It does understand that each generated image must have “legs”, “eyes”, “shells”... and other features that it detected are common in the original images.