Why exactly does hydride acidity increase across period and down group in periodic table? What is the explanation with respect to electrons? I can't figure this out because for 1st period etc H is an anion while for the right and middle of the periodic table H is a cation in compounds formed. I feel confused. Does this have something to do with electronegativity of element that forms hydride?
Yes, but that is somewhat circular reasoning, as electronegativity is largely just putting a numerical value to the trends in properties you are observing. A better answer is to compare the effective nuclear charge holding on to the valence electrons as you go across or down the Table. Going across the table, each electron gets added to the same shell, which means it shields the other electrons from the added proton poorly. Consequently, Z* (the positive charge effectively felt by the outermost electrons) increases, and these electrons are more tightly held. At some point the atom holds onto not only its own valence electrons, but those of the H atom when the H atom leaves, and so the H atom leaves as H+. Conversely, at the far left of the table, the Group 1A atoms hold on so loosely to their lone electron that the H atom is able to leave with the metal's electrons, as H-.
Going down the table, you add a whole electron shell between the nucleus and outermost electrons with each period. That is counterbalanced a bit by the fact that the shells become more closely spaced, but nevertheless for main group elements the extra shielding of the extra shells usually matters more, and so effective nuclear charge falls going down a group.
Finally, bear in mind the "acidity" of a hydride is the tendency of the compound to break up with the H atom leaving as H+. So the greater the Z* of the partner, the more likely the H atom leaves without its electron.