Let G and H be affine algebraic groups defined over a field k of characteristic zero, with H a closed subgroup of G. Suppose they have the same kpoints. Have they to be equal?

No: Take $k$ to be the rational numbers and $G$ to be the group of third roots of unity. Then the only rational point in $G$ is $1$. Then take $H$ to be the component of the identity. This satisfies your conditions but $H \neq G$. The problem here is that the groups are no connected. edit: I notice now after posting my answer that David Speyer suggested the same example in a similar question... 

