This is happening to me too. Seems to have only started recently.
I have a theory that it's random attacks on my settlements (not the defend settlement quest type attacks) as I keep getting the random XP when in range of one of them.
I think its from one of the factions you sided with. I tend to see it usually when a Brotherhood of steel vertibird is flying nearby. It would still be nice to know for sure.
It happening to me too. Sometimes when NPCs fight, I am awarded XP for killing one even if I did not take part in a fight. It's not happening often.
This - it happens to me most often, when I'm at a location and started to clear it out, when suddenly the BoS swoops in and "helps out" (or crashes? lol). I still see the XP ding, even after I'm done and just stand in the area where the BoS is operating. I guess since their field teams are already Paladins, they don't need to level up anymore and I get the XP?! LOL
I get them when I'm near a Vertabird but I haven't even gone to visit
I wonder if it is related to your companion doing something on their own accord.
Yep, some of it is provisioners. I'm an enemy of the BoS so it's not them. Those wandering settlers may account for some also.
I had it happen in the Boston city area, no provisioners or settlements near by. Only BoS fighting Mutants.
Followings can give you exp at random time
1. Creature vs Creature.. a creature being killed
2. NPC/Provisioners killing creatures/enemies near you even if you are not aware of them
3. When you go inside the building... surprisingly things can still happen outside and award you the experience points
Provisioners wander all over the map and get into all sorts of trouble. I know, because I give all mine miniguns, and I often hear the snarl of it as I wander through... everywhere!
Thank god they're invincible. It'd be a massive PITA managing supply lines otherwise.
Allied npcs in the area or some that you are not hostile/an enemy towards they kill you get xp.