So, supposedly Jon Snow is an heir to the Iron Throne because he is the son of a Targaryen prince. However, Gendry is the son of an actual king. So, is it better to be son of a prince, or the illegitimate son of a king?
Not exactly sure this is going to start off how you want it but: simply put, whoever conquers it.
Gendry is illegitimate, which as we see in various places around Westeros means nothing, he has no rights over land or titles of his father without royal decree. and I'm not sure Cersei is going to legitimize him, and I don't see why Daenerys would either.
Jon Snow is the legitimate son of Rhaegar Targaryen, who in turn was the legitimate son of the King. this makes him the heir to the throne, he actually has a greater claim than that of Daenerys, SE user Aegon details why Here
Now the question is would the Lords and Ladies of Westoros recognize a Targaryan claim over a Baratheon claim, and this, I think was summed up quite nicely by Tyrion when he said something along the lines of "The people don't care about about who sits on the Iron Throne, they care about food in their bellies" alas I can't remember the episode though, pretty sure it was Tyrion to Daenerys though
At the moment, the whole possession is 9/10ths thing comes into play. So Cersei actually holds the the claim as she sits on it, if Daenerys conquers Westeros by herself, she will have the most valid claim, same if Jon Snow managed to conquer it by himself.
As of the the end of season 7, Jon has bent the knee to Daenerys so he submits to her claim. I know he does not yet know that his claim even exists and will most likely be a plot point of season 8. And while Gendry does know of his royal blood, he has the burden of proof to show that he is a Baratheon.