Grym is used in two seemingly contradictory ways, one of them negative and the other positive.
The negative sense, translated as 'cruel', 'heartless' or 'mean' is the original: grym, like English 'grim', has its origins in an Old Norse word which referred to something fierce and savage. You might hear about grym treatment of someone or a grym tyrant.
But from the 1970s onwards, the word underwent a transformation.
Swedes began to use grym in a positive sense, meaning something like 'cool' and referring to people, objects or experiences. You can also use it to mean 'good' or great', in sentences like Jag är grym på det (I'm good at that). The change can be compared to the slang use of 'wicked' in English.
Generally, the original negative meaning is used in more serious contexts, such as political speeches, academic papers and non-fiction books, with the newer sense popular among younger people in informal contexts, and in newspapers' sports and entertainment sections (but very rarely in news sections).
So, the sentence han är grym could refer to a brutal oppressor or to an attractive man – you have to rely on other context to figure out which is intended.
Another thing to be aware of is that there's also an adverbial form of grym, grymt. This can be used as a form of negative grym, meaning 'cruelly' or 'savagely', but can also simply be used as an intensifier meaning 'really' or 'very', in sentences like det var grymt kul (it was really fun).
En grym och brutal död
A cruel and brutal death
Han är grym på att springa
He is great at running