dBi is a representation of relative power.
The unit power is relative to a theoretical antenna, called an Isotrophic antenna (or radiator), which is a conceptual point source in space where all energy is radiated from that point equally in 3-dimensional space (similar to how a star radiates light).
dB is on a log scale so when comparing the ratings, you have to consider that. Every 3 dB is a doubling, so 2 dBi vs. 5 dBi is twice in both receive and transmit gain (antennas are typically reciprocal).
In this context, higher dBi is usually better, but it depends. The way an antenna achieves gain is by focusing the energy. An example is how a flashlight reflector focuses the light into a narrow beam (a satellite dish does this).
Higher gain "rod" antennas typically squish the radiation pattern and make it from a sphere (or 1/2 sphere) into something flatter, like a pancake shape in an extreme case. This might be good if your on one story, but if on two floors directly above/below, then it might work better by orienting the antenna horizontal.