I am travelling to Bangkok and just got to know that I will be flying on a 22 year old Thai Airways Boeing 777-200, how safe is it to fly on a plane this old?
It's not that old, aircraft are designed for that. If anything, it's not the age in years but the number of flight cycles that put a limit on the lifespan of an aircraft and long-haul planes like the 777 do a lot fewer cycles than short-haul aircraft.
Note that many parts of a plane are replaced in the course of regular maintenance - you're not flying in a plane where all the parts are factory originals that have been in service for 22 years. In the logical extreme of the Plane of Theseus, you could have a 22-year-old plane that has no 22-year-old parts.
I fly ThaiAir very frequently .... the bkk sector mostly uses 777-200 .... stable aircraft even over the turbulent bay of bengal .... besides these Thai pilots are some of the best!
Many-decades-old cars can last quite a long time too, if they're well-maintained. But most cars aren't that well-maintained. Airplanes, though? They're extremely well-maintained.
22 years is not considered old AT ALL for an airplane...... that's practically new. It's not even that old for a car.. Plus, you know for a fact that the plane has flown many times without incident.