You get 100 XP per HD for killing monsters, plus an extra HD of XP for special abilities. It’s a lot at first, but not a whole lot once you pass third or fourth level.
You get 1 XP per 1 SP that you spend that was earned by adventuring. If you get a bunch of treasure and hoard it you don’t get any experience for it until it’s spent. If you decide to shuffle cargo between towns for money, you don’t get XP for it no matter when or how you spend it.
Also, you get XP for exploration. Being the first one to find a legendary place or thing can confer experience, and some things are so awesome and inspiring that everyone who sees them will get some XP to reflect how it shapes their view of the world or their sense of accomplishment or personal growth.
Finally, if you spend loot on carousing sometimes you get bonus XP. Note that if things don’t go your way, you can also get consequences for carousing!