tl;dr: Either a) this applies only to negative mitzvos, which someone under twenty is more susceptible to break, so Hashem gives people under twenty a free pass, or b) this applies only to mitzvos sichlios, those that an intelligent and mature mind can determine are appropriate, so those under twenty are less likely to come up with them on their own and are not held accountable.
To further @Menachem and @ray's answers:
The Chacham Zvi (Simman 49) asks two questions on the gemarra in Shabbos 89b that implies the Heavenly Court doesn't punish for sins comitted under twenty:
Milah, the Rambam (Hilchos Milah 1:2) and Raavad (ad. loc). sound like once a person turns thirteen and doesn't perform milah, they get kares.
Pesach, the Torah says (Numbers 9:13) that an ish that doesn't perform the Pesach get's kares. Ish throughout the Torah means someone who is thirteen and above.
The Magen Giborim (Orach Chaim 219, Shiltei Giborim 1) wants to answer these two questions (although he agrees with the Chacham Tzvi's conclusions) as follows: Those are both positive mitzvos. We can differentiate between positive and negative mitzvos.
Positive mitzvos even if they are broken above the age of thirteen have no earthly punishment. As such, they shouldn't get off scot-free, and get heavenly punishment.
Negative mitzvos involve succumbing to one's baser desires, and we can say someone under the age of twenty is more susceptible to giving in to his inclinations. Therefore, in Heaven they let earthly punishment suffice.
However, Rav Dovid Kronglass zt"l, Mashgiach of Ner Yisroel (Sichos Chochmah UMusar #50) brings more questions on this gemarra: Why is someone between 13-20 whose ox kills another obligated to pay kofer, which is to prevent death by Heaven1. He also asks from the children from Sedom and the dor haMabul why they were punished. The explanation of the Magen Giborim isn't sufficient.
Based on these questions, Rav Kronglass concludes the approach of the Chavos Yair (#166) and Chasam Sofer (Yoreh Deah #155) is correct, that the less than twenty idea applies only to mitzvos sichlios, meaning only to mitzvos that an intelligent and mature mind can determine are appropriate2. This explains Sedom and the dor HaMabul, who broke explicit prohibitions (gezel, arayos).
I don't remember if he says this explicitly, but it would then follow that the age of twenty is determined because until that age a person can't be expected to be mature enough to realize what should and shouldn't be prohibited on their own.
1 He proves they're obligated from Bava Kama 40a which states a child is exempt and the Rambam (Hilchos Nizkei Mammon 10:6) who says children, deafmutes and deranged people are exempt due to not being obligated in mitzvos (לאו בני חיוב). Therefore, a child who is obligated in mitzvos (13-20) is obligated in kofer.
2 Cf. the Chidah (Nachal Kadmonim parshas Chayei Sarah #2) who says that the Chacham Zvi's approach isn't the simple reading of the gemarra, and I would venture to say he would say the same about this approach.