Jack Sparrow was a legendary pirate of the Seven Seas, and the
irreverent trickster of the Caribbean. A captain of equally dubious
morality and sobriety, a master of self-promotion and self-interest,
Jack fought a constant and losing battle with his own best tendencies.
Jack's first love was the sea, his second, his beloved ship the Black
Pearl.
The son of Captain Edward Teague, Jack Sparrow was born on a pirate ship in a typhoon. Before he was known as "Captain Jack Sparrow", he
was simply known as Jack, a teenage stowaway who, even then, had a
desire for adventure. Jack first sailed on the Barnacle with a young
ragtag crew on a quest to locate and procure the legendary Sword of
Cortés.
As the other answer very well explains, it's no secret that Jack is a shameless self-promoter, but seemingly he earned the name after he trapped Salazar in the Devil's Triangle...
As a young pirate he earned the name Jack Sparrow when he trapped the
notorious Spanish pirate hunter Capitán Salazar in the Devil's
Triangle.
Some Additional Information as for whom "Jack" is named,
Jack Sparrow was born to Edward Teague and an unknown woman on a
pirate ship caught in the middle of a typhoon. He was named Jack
after his uncle and Teague's brother, Jack. Jack grew up in a
tumultuous household full of outlaws at Shipwreck Cove.
But, he did use his full Pirate name, "Jack Sparrow" when he was still a boy, as Bill Turner refereed to him as such in the young Jack Sparrow novel, Jack Sparrow: Poseidon's Peak
"Jack Sparrow..." "Yes. Yes. You know my name. What do you want, a
blue ribbon?" ―Bill Turner and Jack Sparrow
After acquiring a new boat, Jack sets off to find the fabled
Poseidon's Peak and the treasure it holds. He arrives on a deserted
island and runs into a sailor who is badly hurt and has amnesia.
Following a night of fitful dreams the sailor remembers that his name
is Bill and the two of them trek inland to find any clues to where
Poseidon's Peak might be.
(Note: this passage is still from "Jack Sparrow" wiki page)