It's difficult to give a definitive answer, as punctuation can sometimes be a matter of personal, editorial and geographic preference, as well as differing substantially between languages. From my review of a range of sources, it appears that in English there are five broad approaches to commas:
- use a comma to separate certain grammatical elements;
- use commas to avoid potentially ambiguous constructions or to
assist the reader's comprehension of a complex sentence;
- use commas as a guide to the intonation of the sentence;
- refer to the relevant appropriate style guide; and
- use your own style, especially in creative writing.
The ELU page on the "comma" tag provides a good summary of the comma's purposes.
In relation to the question posed, the sentence is constructed with two clauses: (My test was finished within 3 days) + (right after that my dad and I took the earliest flight to come back home). Some style guides require a comma to be used after a conjunction joining two independent clauses; thus:
My test was finished within 3 days, and right after that my dad and I
took the earliest flight to come back home.
However, there's also the matter of the adverbial phrase "right after that" which modifies "took". It's common for such parenthetical phrases to be both preceded and followed by a comma, thus:
My test was finished within 3 days, and, right after that, my dad and
I took the earliest flight to come back home.
Nonetheless, while this might be correct, many would regard it as an excessive use of commas. You might still like to retain the comma after and if you were deliberately seeking to capture specific intonation such as a ponderous or dramatic verbal style. But modern English tends to spurn unnecessary punctuation, in which case the result would be:
My test was finished within 3 days, and right after that, my dad and I
took the earliest flight to come back home.
TL;DR: (a) both your sentences are acceptable; (b) check if you need to follow a style manual that prefers one format over the other; and (c) make sure you stick to the same style throughout your document.
For further ELU debate about commas:
Parenthetical Commas
Nonessential Commas
Erroneous Commas?