In Half Life the Vortigaunt's attack on sight but in Half Life 2 they help the player. Could someone please explain the motivation behind these characters.
In half-life (the first) the Vortigaunts you see are slaves, as evidenced by the green shock collars around their neck. As slaves to the Nihilanth, they are your unwilling enemies.
In the second game, the Vortigaunts encountered are free agents (effectively) and thus are not inherently on the "wrong side".
The Combine wiki has more here.