There are various methods to get experience:
Champion kills: Killing an enemy champion rewards a player with an amount of experience determined by the level of the champion slain. The experience gained is equal to 75% of the total experience required for a champion to go from the slain champion's current level to the next level up. In other words, if a level 7 champion is slain, the total experience gained is 75% of the total experience required for a champion to go from level 7 to level 8, or 705 (= 0.75 × 940) experience points. The experience reward will be increased if there is a positive level difference between champions (e.g. a level 5 champion killing a level 7 champion) and decreased if the level difference is negative.
Assists: A champion is given an assist after damaging an enemy champion that is then killed within 10 seconds. A champion granted an assist will evenly split the total experience reward for killing the enemy champion with all other players that received an assist or landed the killing blow or are within 1600 range of the killing blow.
Minions: Killing minions in League of Legends grants an amount of experience upon their death. The experienced gained by the champion is determined by the type of minion. Experience from minion deaths is split between all champions within 1600 range.
Turrets: Whenever an enemy inner, inhibitor or turret is destroyed, all champions of the team are granted experience depending on the turret. No experience is granted for outer turrets.
Neutral monsters: Each type of neutral monster in League of Legends gives a different amount of experience upon death. Experience points from neutral monsters are split between every allied champion within an 400-unit range. Jungle monsters grant 50% bonus XP per level to lower-level champions, up to a cap.
Teemo's mushrooms also grant experience if destroyed. Doesn't grant experience if they are activated.
Source
But mainly, during the lane phase being around a minion when it dies gives you experience. Also, care not to push too fast as then you will end up pushing the wave to their turret and then they gain experience faster than you. So last hit minions.