The word translated as “generation” doesn’t really mean “generation” as we use the term, that is, to refer to a particular age group of people living at a certain time.
The Greek word translated as "generation" is genea (ἡ γενεὰ), which means "race", "family", "generation", "class," and "kind." It is a from of the word that we get the scientific term "genus" from. Among animals, such as horses, it refers to a given “breed” of horse.
Jesus uses this term almost exclusively in criticism, perhaps the way we used “gang” or “cabal”, to refer negatively to a certain group of people. Often that criticism seems more aimed at a certain type of person , or, more narrowly, the Pharisees and those like them among his own people. (The two links above connect to different kinds of reference tools. The first, in Roman letters, connects to the use of the word in NT translation, but the second, in Greek letters, connects to how to word is used generally in ancient Greek.)
In this case, the meaning could be much broader, referring to the human race or, more narrowly, to the Jewish race.
However, the also refers to an historical group of people, which is where the “generation” translation comes in. This meaning is clearer when its use refers to a group of people in history. Jesus uses it this way upon occasion as well.
Translating the verse literally, the Greek reads closer to: “Truly, I’m telling you true that this race may never pass away until all these things might bring themselves into being.” You can see each Greek word explained in this article.
However, the view of this section of the Gospel as referring exclusively to the apocalyptic end of the world is also a reach. Much of it could refer to the eventual death of all people. More about that in this article. There is a tendency for people to read it as referring to their own generation, times, and death.