The metadata is provided by the labels. For their top-selling popular music that they earn songwriting and performance royalties on, the metadata is typically very thoroughly checked and accurate (although there are still mistakes). For classical music that is long out of copyright for the music, they care a lot less and the metadata is filled with mistakes. Most streaming services make a decent effort to try to clean up the metadata, but to a large extent, it's just a case of garbage in, garbage out.