In the last part of Joker (2019), Arthur was rescued and Thomas and Martha Wayne were killed by a clown-masked gunman, but their son wasn't. Who did that and why wasn't Bruce killed?
In the movie, the clown-masked gunman is an unknown person.
In comic-book canon, it is Joe Chill… or not. It is depending on which comic version you read.
The identity of the gunman is not relevant. He's just a random guy.
What is important is what seems to have brought this guy to seek out Thomas Wayne. Specifically, he is wearing a clown mask, and specifically quotes the line that was broadcast all over TV and made Joker an overnight celebrity:
You get what you fucking deserve!
The gunman shot Thomas Wayne for the same reason that Joker shot Murray Franklin: because they felt their victim deserved it.
Why, specifically? We don't know. But Thomas Wayne is not painted as a philanthropist the same way he is in other Batman incarnations. Remember that in this movie, he specifically said that people who have made something of themselves will always think of people who didn't make something of themselves as clowns.
That arrogant attitude is a very possible reason why one of these so-called clowns sought revenge against him. The city is already buckling under inequality, and Thomas Wayne willingly amps it up, publically.
why wasn't Bruce killed?
Simply put, because the gunman believed Bruce didn't deserve it.
Also note that even criminals tend to have some moral boundaries, and killing children is quite high on that bar.
Whether he killed Martha because he believed she also deserved it, because he wanted the pearls, or because she would be a much more accurate witness than Bruce would be; is never elaborated on.
A large portion of Arthur's actions are reflected on society. Gotham is already a powder keg, and Arthur unknowingly lights the fuse that sets off others to take up violent action, inspired by Arthur's actions.
Indirectly and thematically, Arthur set in motion the events that would kill Thomas Wayne, but it is much too indirect for Arthur to have knowingly done so.