I'm getting confused in my textbook it says HCl is a stronger acid than HBr b/c it has a higher electronegativity.
What book is that?
HCl isn't stronger than HBr. HBr is stronger because Br is bigger, thus having a better ability to stabilize charge. HBr's pKa is -8.7 while HCl is -6.3, so HBr is more acidic since it has a more negative pKa.
What atom the H is bonded to: If in the same row on the periodic table, the one with the more electronegative atom is stronger. However, when comparing atoms in the same group, size is the determining factor. HBr is stronger than HCl, and HI is stronger than HBr because I is the largest, then Br, then Cl being the smallest. This is why HF is a weak acid; despite F being very electronegative, it is extremely small so it cannot stabilize charge as well as HCl, HBr, or HI.
Big atoms can stabilize charge better than small atoms simply because there is more space to spread that charge out. Again, this is when you're comparing two acids, in which the atoms bonded to H is in the same group.
An acid is strong if the negative charge of the conjugate base is stable because then the acid will be more willing to give up H+.