As I understand it, it depends on race and tech.
The basic principle is whatever gets killed in a gravity well provides experience that is divided amongst opposition capital ships - this can include allies, not just ships from the player who gets the kill. I think derelicts and wrecks provide XP only to capital ships within their circle of influence, not the entire gravity well - again allied ships may benefit.
The TEC has a tech that allows for all capital ships to benefit from kills but I'm not sure how that works - there may be limits e.g. starbase kills count, frigate kills in enemy territory do not. The Advent have a Tier 5 (?) tech that allows their capital ships to accrue experience just by being in their own culture. And I think all factions have technology that increases the XP for kills, though I'm not sure if the bonuses are the same across factions.
Sorry this isn't a precise answer but hopefully it helps.