The element hydrogen (H) can form hydrogen halides meaning, it can form H+ ions in HF, HCl, HBr, etc. It resembles group-I elements like lithium, sodium, potassium as they form Li+,Na+,K+ in metal halides (LiCl, NaCl, KBr). So, it can be placed in group-I along with Li, Na, K.
Hydrogen also resembles halogens as it can form hydrides. It can form H− ions in NaH, LiH, etc. Halogens can form such halide ions in NaF, NaCl, KBr (F−,Cl−,Br−). So, hydrogen can also be placed in 17th group along with F, Cl, Br, I as it resembles halogens also. This behavior of hydrogen makes it difficult to place it in a single group.