Just like Ualaa said, a 2nd level animal companion will be 3 HD. They receive 2 HD at 1st level, and then 1 additional HD at 2nd level. Animal companions also don't advance 1 HD every Hunter level. There are some levels where the additional HD is skipped. For example, the companion will not advance a HD when the character advances from 6th to 7th level.
Familiarize yourself with the chart on this page. It should help make things clear.
https://www.d20pfsrd.com/classes/cor...mal-companions