役に立つ is a fixed phrase that has to be learned by rote, but if I really have to analyze it...
- 役: "service", "use"
- に: Here, it's a role marker rather than a destination marker. In other words, it's more like "as X" or "for X" rather than "to X". See: Can に have the same function as として?
- 立つ: This is a light verb that has dozens of possible translations including "to form", "to work/serve (as)", "to excel (at)", "to be viable", "to be realized", "to be made" and so on.
So a super-literal translation of 役に立った would be "served for (some) use" or "was viable as service".
Similar set phrases where 立つ is used in a similar manner include:
- 予定が立つ
- 腕が立つ
- 申し訳が立つ
- 面目が立つ