Short answer? Nobody knows who invented the first cocktail.
More precisely, nobody knows who first stood in front of a few different bottles of alcohol and sundry other delicious beverages and thought to combine them with the purpose of creating a single blended drink as a more enjoyable way to experience alcohol. That is lost to the mists of time and, frankly, really doesn't matter very much as you will come to see.
While the unadventurous would be happy to leave it there, those with a bit more curiosity will want to know more. Thankfully, we do know quite a bit about the history of the cocktail and also about the people who have invented particularly famous cocktails, so let's focus on that.
The Basic Cocktail
The first thing to consider is that the cocktail is not actually a specific drink, per se, but rather an entire category of drinks. And for that, we actually do have a definition that we can link to an actual person at an actual time who appears to have been the first to use the term cocktail and to offer that definition.