Character levels in Destiny 2 are purely a story element - you need higher levels to participate in new missions and get access to new planets and activities. Experience is represented by experience bar and levels - when the green bar is completely filled you reach a new level until you reach the maximum level which is 20.
You get experience mainly for completing missions but you also get it for killing enemies during your free time, completing additional activities, fighting other players or participate in server events.
The best way to get experience fast is to focus on main missions first (usually, completing a main mission gives you a new level, additional tasks for one player give you about half of a level). Don't try to fight with enemies that are much stronger than you (they have a red marker next to their name) - you won't get more experience for them. If you want to level up fast you should select missions that require less Power than you have - they will be easier to complete and the amount of experience that you get for them is similar to those that you get for more difficult ones. However, don't expect valuable rewards but they aren't as important to you when you are not at level 20.
When you finish the campaign and reach level 20 your experience bar can still be filled up by completing the same activities and killing enemies - but this time it is gold. Your level won't be higher than 20 but for filling the bar you get experience points that can be used for upgrading your subclasses. Now, it is time to focus on Power...