As of v3.6, the Defense stat was changed so that it can only be raised with armor, and Magic Levels and Strength Levels were changed to instead be increased through directly training them. With the level cap raised to 250, it is currently possible to have 500 Magic and Strength levels.
Magic Levels are raised when you use magic based attacks, and Strength Levels are raised when you use strength based attacks. Attacks that require more Magic Energy/Stamina will increase the level bar(s) more than attacks that require less Magic Energy/Stamina.
Training stats unlock higher tiers of magic moves, unlock weapon skills, and deal more damage with the attack's respective damage type. It also increases the pool of energy for that stat, which enables you to train even further.