There are several ways to think of Jack because he takes on many, many roles depending on what the movie needs. In general, he's a walking plot device and only very rarely does he develop anything along a character arc. If he does develop, he may not be faithful to it. And his role changes from point to point as the movie has different demands.
Primarily: Jack is an Iconic Character (Hero and Villain)
An Iconic Character is a known entity. They have a very, very strong personality that is largely set in stone. Within any given episode they may explore some of that territory you didn't understand previously; but they always revert back to the mean. Most super heroes are Iconic characters. Who they are is recognized, loved and adored. Anything they go through may be challenging, but it's what they do to the world around them that is interesting; not what they do to themselves. Mad Max is another very good example of an iconic character. Max does not change, he changes his world. And this can be compelling if the world is interesting and needs to change.
Iconic Characters, chemically, are catalysts. They bring to the world something that is different, that inspires chemical change around them, but not within themselves.
Please note there is that one arc with Swan where Jack looks like he's having an arc. It turns out he doesn't; it's all for Swan's character development in the end.
Jack is a McGuffin
A McGuffin is the thing you want to find because as soon as you do you'll get the next piece you need to solve the big problem; whatever it is. Jack often takes on this role, even though he often is rarely pivotal in solving whatever the problem is. He is known to the audience, they feel something about him, they usually want to see him and so just teasing that what you're after is getting Jack Sparrow on the case is enough to hook an audience while you develop the rest of your arc.
Jack as Strange
A thing you like to have in genre fiction, fantasy especially, is a touch of the strange. Jack is usually the character used to introduce and interact with that strangeness. He is usually strongly related to "element x". Access to him grants access to the larger world: one that is scary and exciting. This is not the McGuffin. No one goes out to find the strange. This is a cost of him showing up in your character's lives.
Jack as Antagonist
The antagonist is the one who stands in the way of the primary characters getting what they want. While Jack rarely holds this role the entire movie and is often not thought of as the bad guy; he often is the thing standing in the way of others happiness. Jack becomes an antagonist when a scene needs one. Most often this is because he's after something, usually something very unclear, and it's not until he and the main characters reconcile their directions that they can move forward.
Jack as Problematic Protagonist
Jack is never the protagonist that you root for in the long run, but when he does advance his own agenda it almost always causes problems for others to deal with. This is a classic part of his antagonistic role; but it also sometimes knocks down walls, open doors or initiates the role of a true antagonist to come onto the scene. This is usually a very engaging scene, whenever it happens, because it's usually full of crazy. The point is that it's baked into the character that you expect him to do something for his own reasons that make everything worse. This is very valuable as a plotting device because it often feels organic. Jack is just being Jack again.
Jack as Skeleton Key
I've already alluded to this, but Jack is the one that opens very specific doors. This is a minor part that he plays, but it's important to understand as a facet of his character. At some point he opens a door that otherwise could not be opened. He is one of those items you pick up in a dungeon to get to the mini boss. This is like the McGuffin, but also sometimes something more. Rather than being a boring item sitting in a chest somewhere he walks around, does his own thing and causes problems. So he is a more interesting skeleton key, especially when the things he's doing and the problems he cause factor into solving the character development problem of others. It's very hard to cause character development with a latent prop.
It's easier when your prop walks around and pushes your character past their breaking point, or puts them into a situation where they must make a decision. Jack is ultimately the one who figures out how to do that and the movies occasionally imply he does this intentionally.
Jack as the Lucky Fool
There are lots of characters who only succeed because they are lucky. Chaos can occur all around them and they walk through it unscathed. Occasionally Jack is this person.
Jack as Trickster
This is one of the standard character archetypes. Essentially tricksters have other-worldly or super human knowledge that allows them to deceive others, take what they want or operate within the world by a different set of rules that often seem convenient, contrived, or godly.
Tricksters often do many of the things described above. Getting them to do the thing that is helpful for you when all they are interested is making problems or getting what they want out of the world is a puzzle for others to solve.
Jack as Rogue
A rogue is bad guy who steals from bad people to help themselves and sometimes others. You like them because they do unto worse what you can't. Robin Hood, Guardians of the Galaxy, Indiana Jones, Ocean's 11, and Han Solo. All of these are rogue stories. Rogues are usually thieves because stealing from bad people is easy and appears to be victimless. People naturally like rogues, and they are interesting to tell stories about, because it's easy to have them change their mind or do something awful that has to be dealt with. It’s easy to root for and against them. They live in a narrative gray space that you can play with.
Jack as Comedic Relief
Jack often is only in a scene to lighten the tension or make a joke. Be it about a “thump-thump” or not getting eaten. Jack is the punch line to the joke. If scenes get too tense you usually want an escape release in a movie like pirates to keep the thing fun and light. Without the joke you can easily slip in to Darkness the Darkening. Since Jack does not take the world seriously and at times appears to be slightly insane, it's relatively easy to use him for this; that also makes him fun to watch.
He's not the only character with this feature, and it's not unique to him. It's a part of the world, something in everyone at different times. But he does take it to his own personal extremes and it is used to emphasize all of the other types of roles he has.
It's also the thing that makes you realize he's not going to be the one to save the day. He can't be. He's not focused enough or serious enough. This leaves space for the true hero to step forward and solve the problem. It also leaves space for the reversal, because once the audience doesn't trust him he can actually do something and surprise them.
Jack as Foil
Jack represents those things others want to be and don't want to be at various points. He does this largely without changing himself. He acts as an example of what others could be and choose not to be, or choose to be. How people feel about him is often more important than how he feels about others.
Jack as Failure
Jack is the thing no one wants to be at the end of the day, but everyone wants to be for a day. He had no friends. He has no love. He has none of the things he wants. He's extremely capable, and almost never permanently successful.
He lets everyone see what fun is, but he ultimately conveys to the audience and to the other characters that you don't want fun at the end of the day; you want satisfaction, contentment, acceptance, and fulfilment. (And ok, if the characters are stuck in a rut, sometimes the thing you need is Adventure).
Jack shows others what it means to fail, even if he fails spectacularly.
Jack is a Toolbox, a Jack of all Trades
His primary point of existence is to change the world around him and the narrative. He provides obstacles, reasons to do things, ideas about the world he understands, and brings in the strange. He escalates small problems into large ones. He can't be trusted, but he is needed.
Most importantly. If you have Jack in a scene that's not working, you can do just about anything to make it more interesting and get to the next scene. This was probably important since they largely filmed all of the battles before writing down why they were having them. Which brings up the last and final important point. Used poorly Jack is the cheat sheet the teacher discovers you're using that ruins the rest of your year. The movies that lean harder on Jack are ultimately the ones that suck just a bit more than the rest. Toolbox characters need to be used lightly and with precision or you risk diluting their effect.