If a PC wants to use his whip to wrap around a tree branch and then swing on it, like Indiana Jones, what check would that require? Would it require an attack roll?
Do you even need a check?
We should keep in mind the advice from the DMG:
When a player wants to do something, it’s often appropriate to let the attempt succeed without a roll or a reference to the character’s ability scores. For example, a character doesn’t normally need to make a Dexterity check to walk across an empty room or a Charisma check to order a mug of ale. Only call for a roll if there is a meaningful consequence for failure.
So, the DM should consider the totality of circumstance of this event when deciding whether a check is called for. If this were an unarmed monk using a whip with both hands to swing across a shallow gully in the forest, then no check at all and just treat it as a free object interaction during movement. If this were a heavily armored cleric who has just scooped up a fallen comrade and now has to carry the body across a chasm while supporting a combined weight in excess of their lift capacity while hanging from the whip with one hand - a check is definitely called for. Between these extremes, it is the DM's call whether a check is called for.
If there is a check, what should it be?
To snare the branch - Tool Use
Acrobatics has been suggested, but is not the best fit, since the initial wrap-around is more about using the whip than using your body for a "stunt".
Your Dexterity (Acrobatics) check covers your attempt to stay on your feet in a tricky situation, such as when you're trying to run across a sheet of ice, balance on a tightrope, or stay upright on a rocking ship's deck. The DM might also call for a Dexterity (Acrobatics) check to see if you can perform acrobatic stunts, including dives, rolls, somersaults, and flips.
Rather than using the whip as a weapon, you are using it as a tool, a device to wrap around a branch and then support weight:
A tool helps you to do something you couldn't otherwise do, such as craft or repair an item, forge a document, or pick a lock...Proficiency with a tool allows you to add your Proficiency Bonus to any ability check you make using that tool. Tool use is not tied to a single ability, since proficiency with a tool represents broader knowledge of its use.
'You couldn't otherwise do' reminds us that no matter how good your jumping skills are, you aren't going to be able to grab that out-of-reach branch with your hands. This recommends tool use over Acrobatics. I would suggest Tool Use (Dexterity), with proficiency bonus added if you are proficient in whip as a weapon.
To swing across - Strength Check
Just a Strength check, not Athletics. Strength checks are used for short events, whereas Athletics checks are used for longer or more complicated situations. PHB example of a Strength check: "Hang on to a wagon while being dragged behind it".
Especially if all you are considering is "Am I strong enough to hold on to the whip while I swing?", then just a strength check. However, if it is an entire complicated cinematic process - grab the fallen comrade, jump off the platform, swing across with enough impulse to cross the chasm while taking environmental damage, let go at just the right moment on the other side, stick the landing - then Athletics would be appropriate. PHB examples of Athletics checks: "Cling to a surface while something is trying to knock you off" and "You try to jump an unusually long distance".
But which check, or should this be two checks?
OP Sam asks about a PC who "wants to use his whip to wrap around a tree branch and then swing on it". Had they instead said a PC wants to 'swing across a gap using a whip', a single check would be appropriate. Rule 1 is "The DM Describes the Environment" and presents the basic scope of options. For me, how the DM envisions the environment determines whether this is one task or two. It would certainly be a particularly challenging situation that would call for two checks, but if this is the intent of the DM I would want to respect their narrative structure.
It is true that more checks creates a higher likelihood of failure, and Darth Pseudonym is correct to caution us against "rolling to failure".
If one check, the check would be made for whichever part of two tasks above was the most difficult, or for whichever one carried a higher consequence of failure. If this was a non-combat situation, I would advocate simply narrating a successful result of the whip snaring the branch rather than rolling - "After a few attempts, your whip wraps securely around the branch - now for the hard part" - because absent time pressure, there is no meaningful consequence of failure, unlike the swing. However, if this was a combat or ticking clock scenario and the player wanted to do both these things on the same turn (and assuming that the DM indeed wishes to treat these as separate tasks) then both rolls would be required, because failure on the first roll1 would have the consequence of delaying the completion of the task in a way that was important to the narrative.
1 Or rolls. I would allow one attempt per possible attack per a turn if the character had whip proficiency and Extra Attacks.
You probably don't need a check at all.
I read this question and my first thought was similar, there's probably a skill check involved. But that got me thinking: how hard should this actually be? So I set out to figure out if this was even possible, and discovered that not only is it possible, it's probably so easy that no check should be required at all.
I found this video from AdamCWM on youtube. In the video, Adam demonstrated wrapping the whip around a large branch while standing atop a step ladder, and then successfully swings from the branch. Now, from what I can tell Adam Winrich is a professional whip wielder, and an artisan craftsman when it comes to whips - obviously someone who would have proficiency with a whip. But the move he uses to wrap the whip around the tree branch is nothing special. In the video, he casually slings the whip over head in the direction of the branch and it works effortlessly. I don't mean to be an armchair whip user presuming upon my own non-existent skills, but I really think anyone could do the move he did to wrap the whip.
As for swinging across a gap, I have been proficient in rope swings since I was five years old. Any adventurer should be able to swing without issue.
In general, I never want to call for two rolls to do a single task like "cross this gap", unless what you're actually doing is setting something up to make the same task easier for other party members, like throwing a grappling hook so that the party can scale a slippery cliff face more easily or constructing a makeshift bridge across a gap.
If you want to use a whip to swing yourself across a chasm instead of trying to jump it, I would definitely not call for two separate rolls to do it. That's heading into what some people call "rolling to failure", breaking a task down into enough rolls that you can virtually guarantee failure just because you'll eventually roll low. In general, if you're considering breaking up a task into multiple rolls, and failing one roll obviates any prior successes*, then they are probably not actually separate tasks and should be handled with a single roll.
In the described scenario, I'd probably call for an Athletics check, but I'd base it on Dexterity instead of Strength via the Skills with Different Abilities variant rule, because hitting your whip target and controlling your body in a swing seem like feats of agility to me, but it's probably not going to fall under Acrobatics.
Another way to look at it is, normally I'd call for a Strength(Athletics) check to leap across a gap that's too wide to jump based on your stats. A player who says, "Instead of jumping, can I--?" is asking to use a story reason to apply a skill and/or ability that they're better at, and that's entirely valid. Defaulting them back to the same skill check you would have otherwise asked for is actually denying what they're looking for by coming up with a plan beyond the brute-force solution. (Though sometimes my players' Cunning Plans get out of control and I do have to tell somebody "Well, you can try that, but you have a pretty good Strength, so it might be easier for you to just jump it.")
*To explain what I mean here: If you're trying to stealth through an enemy camp, each roll should basically represent bypassing an encounter. Yes, eventually you're going to get caught if the stealth section takes long enough, but each success represents a fight you didn't have. The fact that you eventually got caught doesn't mean the failure has obviated the successes you had previously. By contrast, if I'm calling for stealth checks at each guard, but any failure means you have to fight the entire camp, then I'm really just denying you the opportunity to be sneaky; only a perfect string of successes will mean actual success at the task, which was to sneak through the camp.
Most likely acrobatics followed by athletics
No attack roll would be involved since you aren't actually attacking anything and there is no AC to overcome.
Controlling the whip to loop around the tree branch would require a demonstration of finesse akin to the ribbon competition in gymnastics so acrobatics would be a good match.
Actually swinging on it would be athletics since you are using strength to push off and hold onto the whip while swinging.
Keep in mind that you can swap which stat is used for a skill check so you could arguably use athletics (DEX) followed by athletics (STR).