For various reasons they are secretive about this, but the genre system is inherited from EchoNest which they acquired in 2014. EchoNest's main idea was to combine audio analysis with natural language processing and web scraping to categorize music. In fact the two founders were PhD's in each respective field.
But nowadays I'm guessing they are utilizing their huge dataset of playlists to group artists under tags. Obviously such systems will work better the more popular an artist is.