Gained by completing Quests and defeating mobs (monsters), Experience Points (a.k.a. EXP, xp or XP) accumulate and automatically increase a character's Level (Lv) at certain thresholds - see table.

EXP can be lost when a player is defeated by a mob and, yes your character will delevel if it is defeated too often.

You cannot lose EXP when you are defeated by a player unless you are playing on the hardcore PvP server.