I know that even light can't escape from a black hole's gravity and the velocity of light and gravitational waves are the same. How can only gravitational waves escape from its gravity?
I see this phrase all the time, and I have to say I've come to greatly dislike it because it's a very bad misnomer. Nine times out of ten, when someone is talking about a black hole, they describe it as an object with such strong gravity that "not even light can escape".
However, this unqualified statement presents a strong misconception as to what black holes actually are and how they work and accomplishes nothing but confusing innocent bystanders such as yourself. The gravity of a black hole is no more or less strong than any other object in the universe. Black holes are not cosmic vacuums which use their powerful gravitational forces to suck up all nearby matter, light, etc. In fact, if you replaced our Sun with a black hole of exactly the same mass, all the planets in our system would go about orbiting exactly the same way and wouldn't notice a difference at all (aside from the mass extinction on Earth due to no longer receiving any energy from the Sun).
That being said, let's paint a better picture of what a black hole is and how it works. A black hole is a clump of mass which has become so massive that the gravitational force of that mass on itself, trying to pull it together, actually collapses the mass into a singularity. The singularity is a point-like region of space where all the mass becomes contained. Slightly outside this singularity, the physics gets weird. For example, if you're right next to this singularity, and you calculate the speed needed to get away from that singularity (e.g., you need to travel ~11 km/s to get away from Earth) you find a speed which is much greater than the speed of light. That's the origin of the phrase "not even light can escape". But, if you start farther away from the singularity, you need less speed to escape it because you feel less gravitational pull from it (gravity decreases with distance). This means, at some distance from the singularity, the speed of light actually is fast enough to escape the black hole. This distance is so important that scientists have given it a special name, the event horizon. It can get a lot more complicated than the simple picture I've painted above, but that's the general idea.
If you put all that together, then that tells you that any light which is outside the event horizon has no trouble escape the black hole. It is only the light inside this event horizon which cannot escape. Likewise, any gravitational waves outside the event horizon can escape just as easily. This is what the answer by StephenG meant by saying they were "outside" the black hole. By outside, he meant outside the event horizon. And it is true that as long as the creation of the gravitational wave happens outside the event horizon it will escape the black hole.
And just for reference of size, the supermassive black hole in the center of our galaxy, which is 4,000,000 times more massive than our Sun, has an event horizon which only extends ~10,000,000 km. That's barely out to the orbit of Mercury if it were in the position of our Sun. So you can see, it's not very hard to be outside the event horizon as the event horizon isn't that big in astronomical terms.
Gravitational waves are a distortion of space-time outside the black hole. They don't have to escape, because they're already outside.