Both!
So with insects and arthropods (things with exoskeletons) in particular, there was a period in Earth’s past that had intense oxygen levels where they grew HUGE. Not like ‘monster movie’ large, but we’re talking centipedes that are several feet long and such.
Evolution through natural selection doesn’t just go one way. It doesn’t have an ‘end goal’. It’s always about selecting traits that are best for the CURRENT environment the population finds itself in. When that environment changes, the selection pressures change.
Island Giantism and Dwarfism are extreme versions of this. Look up the youtube channel Atlas Pro for it’s videos on that subject. They’re excellent.
Generally speaking though, there’s a problem with being exo-skeleton based. These animals don’t have the same kind of lungs and circulatory systems we do. Oxygen has to come in and migrate to the center of the organism, and the less Oxygen rich the atmosphere is, the harder that is to do…so insects have to stay smaller. A ‘growth ray’ like in a sci fi movie to make a huge ant…would result in a DEAD ANT very quickly because even if it didn’t just collapse under it’s own weight, it would suffocate at that size.