From Bulbapedia, the community-driven Pokémon encyclopedia.
Levels are a measurement of how strong a Pokémon currently is. They are portrayed differently in the anime, games, and manga.
In the games
Levels are featured predominantly in the Pokémon games. They are determined by how much experience that Pokémon has. A Pokémon's level will range from 1 to 100. When a Pokémon gains a level, its stats increase by a small amount. It may also learn a new move or evolve. Opponent's levels may be viewed in-battle, and players may see their own Pokémon's levels in-battle, in the PC or by using the menu.
A Pokémon's level will also affect its happiness, raising it slightly when the Pokémon levels up. This means that a Cleffa trained in battle will eventually evolve into a Clefairy, with its happiness going up slightly each level. Using Rare Candies will also raise happiness, though for a long time people thought it did not, due to a Pokémon's happiness also being raised by the large amount of walking that a player must do in long grass to encounter wild Pokémon or recharge such items as the Vs. Seeker.
In Generations III and IV, when a Pokémon has reached level 100, and has not gained maximum EV's, it cannot continue gaining Effort Points through battle. Vitamins can still be used to raise EV's. In Generations I and II, the player can use the box trick.
By exploiting the Missingno. glitch in Generation I or using other cheats, a Pokémon can temporarily acquire a level higher than 100. However, whenever this Pokémon gains any amount of experience, its level will revert to 100.
In Generations I and II, Pokémon assigned to the "Medium Slow" experience formula (1,059,860 Exp. at level 100) were unavailable at a level below 2 due to the "Medium Slow" formula generating a negative Exp. value at level 1; this resulted in such a level 1 Pokémon jumping straight to level 100. Pokémon eggs, therefore, hatched at a standard level of 5. The Generation III overhaul addressed this error; however, eggs still hatched at level 5, likely to maintain continuity. Generation IV finally set all hatched eggs to level 1.
Through some unique circumstances, it is possible to have Pokémon at a lower level than they are usually available. Underleveled Pokémon appeared as early as Pokémon Red and Green, with level 4-6 Kakuna and Metapod available in Viridian Forest. Kakuna and Metapod cannot be obtained by evolution until level 7.
In Pokémon Red and Blue, it is possible to obtain an Electrode as low as level 2. To do this, one must catch a Pikachu in Viridian Forest at level 2, evolve it with the Thunderstone, and trade it on Cinnabar Island. Underleveled Pokémon also appeared in Pokémon Yellow, with level 9 Pidgeotto available in Viridian Forest. Pidgeotto cannot be obtained by evolution until level 18; this event is meant to syndicate with the anime.
The following generations have all contained areas where some Pokémon may be found underleveled:
Some non-player character Trainers use underleveled Pokémon in battle. Lance has three underlevelled Dragonite in the Generation II games; Mars has a Purugly at level 16 in Pokémon Diamond and Pearl. Many other in-game Trainers also possess underleveled Pokémon; this is primarily done to fill the player's Pokédex at a faster rate.
In Pokémon Emerald, the Pomeg glitch allowed players to obtain any stage of a Pokémon capable of being hatched from an egg at level 5, such as a Tyranitar.
When a Pokémon is obtained in a trade, it oftentimes will not obey the player's commands if it is at too high a level. The Pokémon will either ignore orders and use a different move, do nothing at all and loaf around, or go to sleep. This can be corrected if the player has the proper badges. Having less than two badges means that no traded Pokémon whose level is above 10 will obey the player, while having all eight makes all Pokémon obey the player. The specific badges that cause a rise in the level of obeying Pokémon can be found on their page, though they are typically the second, fourth, sixth, and eighth badges obtained.
In the anime
The concept of levels of Pokémon is not as detailed, nor as frequently mentioned, in the anime. The first time levels were referred to was by students at the Academy in The School of Hard Knocks. One of them was able to quote the levels at which Pidgey and the rest of its family evolve and learn certain moves. The main characters and their Pokémon, however, remain seemingly oblivious to the idea.
Misty mentions them in Bulbasaur's Mysterious Garden where she says "That Rhyhorn must be at a high level!" referring to a trainer's Rhyhorn's formidable strength as it uses Take Down on Ash's Bulbasaur, severely injuring it. This confirms that she is aware of levels and that the ability to inflict damage on certain Pokémon becomes easier when a Pokémon grows a level.
Drake comments that Ash's Charizard is on a higher level than he thought.
Brock mentions them once, in Doing What Comes Natu-rally!. He states that moves become more powerful as a Pokémon's level is raised; and Ash adds that the best way to raise levels is by battling. Despite this, Ash's most used Pokémon, Pikachu, doesn't show signs of being at a higher level than any other Pokémon. After appearing in more than 600 episodes, and battling in most of them, its level would be expected to be very high: but it is still defeated easily by some other Trainers' Pokémon, even those with only average strength.
Dawn's Piplup also shows that the anime doesn't strictly follow the games' system. In its debut episode, it used Bide, a move Piplup normally doesn't learn until level 18, by which point it would be showing signs of evolution. This did not happen until Stopped in the Name of Love!. Therefore, level up moves can generally be learned at any time in the anime.
In the two Mystery Dungeon specials, levels are mentioned, but not explained. This may mean that Pokémon themselves understand the concept of levels in the anime but humans do not.