In galaxy optical spectra, why are Hbeta and Hdelta sometimes absorption lines? I've heard that $\mathrm{H\beta}$ and $\mathrm{H\delta}$ lines in galaxy spectra might be either emission lines or absorption lines, is that correct?

From Wikipedia, Balmer lines are usually emission lines in the spectra of spiral and irregular galaxies probably due to the presence of type A stars. If ellipticals lack hot (O, B and A type?) stars, and are gas poor(?), then is it the remaining stars doing the absorbing?

Also, are the CaII-H and -K doublet ever emission lines?
In the absence of emission lines from ionized gas, the (optical) spectrum of a galaxy will be the sum of the spectra of individual stars. These spectra will have absorption lines for hydrogen (H-alpha, H-beta, H-gamma, H-delta, etc.); the absorption lines are strongest for A stars and weaker for both earlier (O, B) and later (F, G, K, M) stars.

If ionized gas is present (as is typical for spiral and irregular galaxies), then there will be hydrogen lines in emission. (This is normally due to O and B stars, which ionize gas with their strong UV emission; you've misread what the Wikipedia article actually says about A stars.) The emission is strongest for H-alpha, weaker for H-beta, and weaker still for the subsequent Balmer lines. This means that emission from H-alpha and (usually) H-beta overwhelms the stellar H-alpha and H-beta absorption, but H-gamma, H-delta, etc. can often still be seen in absorption because the emission from those lines is too weak to "fill in" the absorption lines.

Elliptical galaxies usually have only F or G and later stars present; they usually lack both the gas and the UV-emitting O and B stars necessary to ionize the gas, so you see only the stellar absorption lines.

The Ca II H and K lines can be seen in emission from individual M stars, due to emission from their chromospheres being strong enough to overwhelm the absorption in the photospheric spectrum (e.g., https://arxiv.org/abs/astro-ph/0602293).