Hey student! =)
Great question!
When you have two noun phrases next to each other, you have to determine whether the 2nd noun phrase (not the 1st) is essential or nonessential. It is always the 2nd noun phrase that will receive 2 commas around it or 0 commas.
1st noun phrase = President
2nd noun phrase = Thomas Jefferson
So, to determine whether you place commas around Thomas Jefferson, look at the first noun phrase (president). Since this noun is general (there could be many presidents), Thomas Jefferson is essential (no commas).
However, if the first noun phrase said "the third U.S. President," there can only be "one" third president, right? So, Thomas Jefferson is now considered nonessential and should be surrounded by commas. (The third U.S. President, Thomas Jefferson, was great).
To help you out even further, I wrote some material on commas (essential/nonessential) that you might find helpful and attached it here.
I hope this helps!
Keep moving forward!
You got this!