A: I traveled to Africa last month.
B: Did you pet a hyena? I'm just kidding.
A: I didn't pet a hyena, but I was chased by a rhino, and it was fun.

- Does "Did you pet a hyena" have a figurative meaning here? If so, what does it mean?

Thanks very much to Teachers,

It's not exactly figurative. As a transitive verb to pet means to fondle or caress. Quite a bizarre thing to do to a hyena I guess!
I think to " pet " here means to " stroke or caress gently " as one would do to a cat but no,not to a hyena!