This is a very under-discussed topic in introductory physics classes. The instructor would just tell you this for a fact with no further discussion on the topic which is the source of a lot of confusion. Well, as answered already, it is a matter of convention. You "agree" to draw a certain number of field lines and then compare, "fixing" the number of field lines to what you agreed. This concept is better understood when talking about electric fields. Know that electric field due to a charge $q$ is $$E= \frac{1}{4\pi\epsilon_0}\frac{(q_1)(q_2)}{r^2}$$$$E= \frac{1}{4\pi\epsilon_0}\frac{(q)}{r^2}$$
Field density is something you'd appreciate being called what we're dealing with. Let field density be defined as
$$D= \frac{n}{A}$$
$n$ is number of field lines passing through any surface we choose and $A$ is area of that surface. For simplicity, sphere is the most symmetrical surface, so we choose it to be a sphere. Note that it is purely conventional. $r$ be the radius of sphere. We choose a sphere around a charge, certain number of field lines cross it, we choose a larger sphere, same number of field lines cross it, but now less "densely" namely, less number of field lines per unit area.
The convention is that we choose $\frac{1}{\epsilon_0}$ lines for a unit charge. A charge $q$ would "give out" $\frac{q}{\epsilon_0}$. This convention makes life simple as in, the Electric field at any point is now the lines density itself.
Similarly, for magnetic field, since we choose to draw a certain number of field lines, say 7 field lines for every one "bar magnet", then we can cleverly compare things without getting mathematically complex.