I prefer to treat Level and Size as separate things. To me “Level” has always meant “degree of competence and power”, while “Size” should just mean “meat points” (i.e. Hit Points as a result of body mass that make a creature harder to kill, but don’t necessarily contribute to its overall competence). D&D doesn’t handle this very well, but the way I would handle it is to treat “Level” as the thing that determines things like Attack Bonus/Thac0, Saves, Skills, Proficiency Modifier (in 5e), etc. along with base number of class-based Hit Dice, then treat the creature’s Size category as something that grants bonus HD that don’t affect anything level related, as well as a bonus Strength and Constitution, and other size related benefits (bonus to resist knock downs, etc.) and penalties (reduced chances to sneak, a penalty to Dexterity score perhaps, etc.).
Based on 5e Size categories (Tiny, Small, Medium, Large, Huge, or Gargantuan), for example, each size category above Medium could grant perhaps a +4 to Strength and Constitution, +4 to special attacks (bulrush, etc.), and +3 Hit Dice, but impose -4 to Dexterity, -1 to AC and -2 to Stealth. While each size category below Medium could grant +2 to Dexterity and Stealth, but impose -2 to Strength and Constitution. Obviously these could be adjusted based on system/edition and such, and STR/CON bonuses are compared to human 3-18 scale when creating new creatures rather than thrown on top of an existing Monster Manual large creature’s scores, but it provides a general idea of how to treat Size separate from Level.