So there's absolutely no simple answer to this and it goes in all sorts of directions, so it gets incredibly complex actually, but sticking to the PHB and ONLY talking about the forgotten realms as a setting, uh... Before I explain anything, recommendations, and then I'll explain a bit.
I'd recommend watching videos by MrRhexx and Jorphdan to start with, they're both really good. Wade allen has some really good videos about the planes if existence too, I'd also recommend that.
Also just, reading the dnd rulebooks, they also have good chunks of at least basic lore even when that isn't the focus, and for 5e sources at least I'd recommend Volo's guide to monsters and Mordenkainen's tome of foes, because both have really good lore sections. If you don't have them, look them up online, plenty of ways to read 'em anyway.
So, gnomes, I'm not sure exactly what you're referring to, kobolds hate gnomes because of a long ongoing racial war and mutual grudge between the two races. In short, the kobolds enslaved the gnomes in ages long past, and to free them the gnome god stole shit from tiamat (goddess of evil dragons), who sent the kobold's god (who works for her) to retrieve it, and the gnome god tricked the kobold god into an infinite maze and collapsed the exit so that the kobold god is trapped forever. A kobold would make a dwarf's grudge look tame, so there are ongoing issues, to say thr least.
As for the drow, uh, they're just straight evil. I wouldn't even call it racism so much since they really ARE just straight up monsters more or less, and by vast majority I mean like 99.99999% of them. The dark elves of old, before they were cursed and became the drow, were demon worshiping warmongers serving an evil goddess that was a traitor to the rest of the pantheon, and now as the drow their shit is so fucked up I can't even talk about it without maybe getting banned, research drow pregnancy at your own risk. Nowadays the drow raid the surface world, abduct people for slave labor and murder a bunch more people along the way, and generally facilitate demons entering the world which is all sorts of problematic on a literally cosmic level. The fact there are good drow AT ALL is an enormous deal. Basically, what DIDN'T the drow do would be an easier list to make, if there would be a list at all.
For the race that has the most privilege, depends where you are, but it's probably humans. Overall it's a very "you've just gotta get familiar with the setting and there aren't easy answers" kinda question.
As for what makes a race sentient, eh, roughly speaking an intelligence of at least 8, the ability to speak (not just understand, but speak) languages, and an alignment other than "unaligned." With alignment being the lowest standard because even the most otherwise mundane rock can have an alignment, but still, and the ability to speak languages being the biggest indicator, since it shows the ability to understand and communicate complex thought. Intelligence scores are kinda a fuzzy grey area because technically speaking it's possible to have an int as low as 3 with normal rules, but most sentient races average around 10. Ogres and hill giants have 5 int and they're dumber than a sack if bricks but still sentient, while non-sentient dolphins have 6 int but no alignment or languages, and there are non-sentient constructs that can have a higher int than some player characters but which still also lack alignment or languages. It's a big messy. Any creature with "unaligned" instead of an alignment is almost certainly, by definition, non-sentient, since it lacks the ability to make moral decisions whatsoever. It is distinct from neutral alignment, which is a choice to abstain from moral decisions, more or less.
Also there's like, a hundred settings that are different from the world where BG3 is set, and things change from setting to setting. The most common settings in 5e is the forgotten realms, planet of toril, continent of faerûn, on the sword coast and the surrounding area.
Happy to answer more questions if they're more specific than "why is racism" but generally, again, YouTube. Lore videos are your friend.