It is the material used for the surface of the fibre-board. (By the way, it's foil-effect, not "affect".)
It is a high quality surface layer for 'MDF' (fibre-board). Whereas melamine is used on chipboard - often at the cheaper end of the price range. Though, having said that, melamine is extremely tough and makes better worktops in kitchens than foil. Foil is fine in bedrooms and offices for worktops. It is softer to the touch than melamine - which is hard and brittle and it can be produced with a photograph of timber on it, for example, like pine or maple, or oak etc. (to 'affect' a look of real wood) whereas melamine only holds a random pattern or is plain. Foil can be plain also.
It is used as the surface layer for MDF, whereas melamine is the surface on chipboard.
In furniture like kitchen, bedroom, office etc. the doors and drawer-fronts are almost always either foil or real timber, as melamine and chipboard together are not good materials for producing the moulded shapes, profiles and mock fielded panels often found on doors. Simple radiused, or bull-nosed mouldings such as the edges of worktops can be produced with chipboard and melamine. If the worktops are also 'foiled' though, they usually boast more complicated, ornate, moulded edges, and even 'real' woodgrain motifs. These are usually the middle-range products in the pricing schemes.
Oddly, or so it might seem, the high-priced 'top-range' finishes are quite often in chipboard, not MDF; but that is because neither foil or melamine is used as the surface layer but real oak or maple (etc) veneer. Which is fine on chipboard. Though even on these ranges, things like cornices and skirtings are still foiled MDF.
It is nothing to do with whether or not the furniture is "rubbish". But foil is often considered to be of higher quality than melamine. (You just wouldn't want it for kitchen worktops).
It is so called because it is, literally, a foil material, bonded over the MDF (the fibre-board) as an outer-layer.