There are many ways to gain XP, I will try to explain some of the most popular
D-class XP -> Exchange scrap (press E on the NPC in showers) gathered from trash found in dblock (containers, bins, piles of trash on the floor) or participate in experiments to get credited
Combat XP is gained by killing other players (don't RDM, though) as a non-SCP job or by gaining credits as an MTF or GSD role (cadet, officer, etc.).
Research XP -> Gained by crediting D-class during experiments, having your documents approved on the SCiPnet (the better the grade, the more XP you gain), and submitting a sample syringe to the dispenser.
SCP XP -> Gained by killing players as an SCP job or by being a subject to sampling.
Support XP -> Gained by healing, reviving other players as medical jobs, or by using a field kit. You can also get it by cooking as a chef, repairing stuff as a technician, tech expert, or IT specialist, and by gaining credits when on those jobs.
All roles on the server gain a small amount of passive XP after some time—the XP type is dependent on the job you play.