Atomic weights, like much else in chemical science, were the result of a long sequence of developments and discoveries; but a convenient starting-point for the discussion is "A new system of chemical philosophy" (1808, 1810) by John Dalton (1766-1844)).
In brief summary of the detail offered below, the H = 1 scale was originally an arbitrary (and rather rough) relative scale of atomic weights. With increased refinements in measurement, the atomic weights on this or any other scale ceased in general to be whole numbers (see also (Before the discovery of the neutron, how did scientists explain standard atomic weights?)). The current assignment of H as about 1.007 comes from a re-scaling that by convention put oxygen O = 16 , although as a result of slight adjustments, O itself also now varies slightly from exactly 16, even if only in the fourth decimal place, (see 'Atomic weights of the elements (2017)').
Returning to John Dalton in 1808, one of his starting points was that there were "ultimate particles" of matter, and also that in "a given volume of any gas, we seem persuaded that, let the divisions be ever so minute, the number of particles must be finite". Dalton claimed no originality in the old idea of ultimate particles, but he also saw clearly that
"Chemical analysis and synthesis go no farther than to the separation
of particles one from another, and to their reunion. No new creation
or destruction of matter is within the reach of chemical agency. ...
All the changes we can produce, consist in separating particles that
are in a state of cohesion or combination, and joining those that were
previously at a distance."
Dalton's concept of chemical substances was that for each distinct substance there was a characteristic 'atom', either simple or compoound. His book proposed a (rather awkward) set of symbolic diagrams (see extract below) for several of these 'atoms',
along with a table (below) that gave estimates of how the compound ones were made up of the simple ones in terms of their relative contribution by weight to the compound.
Everybody familiar with basic chemistry will immediately see that many of these early estimates of proportions and weights were quite some way off. But some ideas persisted through later improvements in precision of measurement and fresh discovery, especially for example
-- that the 'atoms' combined in whole numbers to make a compound atom (what is now called a molecule),
-- that the whole-number presence of (simple) atoms in (compound) atoms reflected that the combining proportions of chemical substances were definite and fixed, and could be expressed in terms of relative or 'equivalent' weights that would combine with nothing left over,
-- and that the lightest of the combining equivalent weights was that of hydrogen.
This made it natural to assign to hydrogen the weight or mass of '1' on what was originally an arbitrary (and rather rough) relative scale.
The errors and uncertainties in these early assignment of atomic proportions and equivalent weights were given considerable clarification and correction almost simultaneously with Dalton's book, by Joseph-Louis Gay-Lussac.
His important (1809) law of combining volumes proposed that when gases react together (and the conditions are such that nothing of the original reactants is left over), then the ratio between the volumes of the reactant gases can be expressed in simple whole numbers (when all volumes are measured at the same temperature and pressure). If the reaction product was gaseous, then its volume too could be expressed as a whole-number relative to the reactant volumes. (This gave another way to determine equivalent combining weights, based on the densities and volumes of the combining gases.) See his "Mémoire sur la combinaison des substances gazeuses, les unes avec les autres" English translation: (Memoir on the combination of gaseous substances with each other).
Some of the later developments that soon complicated this picture -- and established, through increased refinements in measurement, that atomic weights on any scale ceased in general to be whole numbers-- are described in this answer (Before the discovery of the neutron, how did scientists explain standard atomic weights?), which also features the isotope discoveries of F W Aston from about 1919 onwards.
During the two centuries since the works of Dalton and Gay-Lussac, the atomic-weight scale has several times been refined, sometimes in interests of maintaining a close relationship to standard measurement tools. For example, in the 20th-century, atomic weights have been re-scaled to define the atomic weight of the isotope carbon-12 to be exactly 12,
or oxygen-16 to be exactly 16. But these alterations have always left the weight assigned to H to be pretty close to 1.
The current table is derived from a re-scaling based on the convention that oxygen O = 16. This is what leads to H = about 1.007 instead of 1 exactly, but the current scale has undergone very slight adjustments from time to time, e.g. as a result of improved measurements, and O itself also now varies slightly from exactly 16, even if only in the fourth decimal place.
The calibration of the atomic weight scale in terms of a terrestrial standard unit of weight came much later than Dalton and Gay-Lussac, of course, and is really another subject.