During the ancient and medieval periods in the west, heavy infantry was a term used by military historians to decribe any soldiers who relied on short-range, armed combat on foot. The exact details of a heavy infantryman's equipment varied from time to time and place to place, but they were usually armored as heavily as possible and carried melee-type weapons, such as swords, pikes, or the occasional axe (which enjoyed a special vogue among Vikings).
Heavy infantry is probably the first of the four major weapon systems used by the people of the ancient world, being essentially the simplest. After all, a guy with a sharp stick and a leather shirt can fairly well perform most of the tasks to which a heavy infantryman would be assigned. The archetypical western heavy infantryman was the Greek hoplite. These citizen-soldiers of the Greek city-states equipped themselves with as much armor as they could afford, usually at least a helmet and shield, and often carried a spear, although other armaments like swords were not unheard of. The typical hoplite army would usually be organized into a reasonably simple phalanx--i.e. a tight rectangular formation in which the front line locked their shields together to provide as much protection as possible while engaging the enemy while the lines behind them would act as a reserve for the fallen from the front lines. The same basic model, with some embellishments, was also adopted by the Romans later.
Tactically speaking, the heavy infantryman's strong point was defense. Because they could be used to man fortifications and because when unfortified they depended strongly on mutual reinforcement and hence a tight, static formation, the heavy infantryman was most useful when he could remain stationary while engaging the enemy. Heavy infantrymen were especially useful against the charges of heavy cavalry, since they were able to use their weapon with greater concentration and skill than their mounted opponents due to the fact that they weren't trying to balance on a horse and kill people--they could focus on the latter. Heavy infantry was none too strong in many other situations, however. Because of their lack of mounts and the weight of most heavy infantry's armor, they were the slowest troops on most battlefields, which limited their ability to perform envelopments, pursuits, and other speedy maneuvers. Also, they were particularly vulnerable to both light cavalry and light infantry, whose ability to attack from a distance and to retreat while simultaneously attacking both meant that they could effectively exploit the heavy infantry's lack of mobility to engage in hit and run tactics. While the heavy infantry in an army was usually armored fairly heavily, this was not always the case (the Gauls that the Romans fought only wore helmets and carried shields, and medieval infantry was typically peasantry with farm tools for weapons and wearing whatever they'd been conscripted in) and even when it was, armor did not make soldiers totally impervious to missile attack. Additionally, the dependence on formation meant that the effectiveness of heavy infantry could be greatly reduced if a manner was found to break them out of formation, such as the aforementioned hit and run tactics of the missile troops on the field.
Economically speaking, the heavy infantry was potentially one of the cheapest of the four weapon systems known during the ancient and medieval periods. As previously stated, its equipment is a fairly simple matter and its use requires very little training in order to be effective. This is one of the reasons that the citizen armies of Greece, whose day jobs typically meant that they had little reason to invest enormous sums in their weaponry or armor, used them so extensively. The same is true of Rome, whose strategy often focused on simply having an incredible number of troops on the field. Heavy infantrymen were easily equipped and since they only required enough food for a single man (rather than a man plus a horse in the case of cavalry) they were therefore also fairly cheap to maintain.
Heavy infantrymen were much more prevalent in the ancient period rather than the medieval, a fact which is slightly mysterious considering the effectiveness of heavy infantrymen in many military tasks. During the medieval period, most commanders came from the ranks of the mounted troops and thus did not understand the uses or relevance of heavy infantrymen. This is not to say that heavy infantry was never used in medieval warfare, just that it was much more rare than in previous times, primarily because of its negative associations with regard to social class. Heavy infantry was seen as a peasant's way of making war in medieval Europe. After all, who would want to be down in the mud with everyone getting killed if they could afford to sit above it on a scary animal? It still saw use in both assaulting and holding fortifications, and some peoples even used heavy infantrymen as their primary combatants, such as the Vikings. Their sea-based raids precluded their bringing along horses, and although raiding parties typically stole animals to provide them with mobility on their raids, Vikings typically dismounted their relatively low quality stolen farm nags prior to any combat in which they might be engaging. This gave them the advantage of a firmer seat than their horsed opponents and thus allowed them to make use of their favorite weapon, heavy axes which were capable of knocking down either a man or horse in a single blow.
Although weak in opposition to long-range weaponry, especially that of cavalry, heavy infantry troops enjoyed dominance in defensive combat, since their main advantages were their steady footing and armor. Their dependence on mutual support within the unit made them relatively easy to foul in combat, though, especially when undisciplined, since it made them relatively tough to adapt on the fly to the always-changing battlefield environment.
All facts and most interpretations in this writeup are taken from Archer Jones's book, The Art of War in the Western World.