Well, not really, you get XP for defeating monsters. Actually spilling their blood or metaphorically. So, the expression goes, XP for blood (as opposed to, say, XP for gold).
Challenges can be a lot of other interesting stuff, like getting the king to acknowledge you as the new baron of Breakwater*.
Getting XP for defeating monsters that do not bring you closer to your goals is weird. The more you loiter the more experience you get, thanks to the random monsters wandering around.
But giving XP for achieving goals, that's the ticket.
(As for the method as it is used in Tyranny, I don't know. It feels like getting XP for passing a train station.

)
* DM: No XP for that, but if you kill the king you'll get enough to level twice.