If you ask most people who have flown, they would probably say they have seen these “pod-like” structures under the wings of an aircraft. Some people assume that they hold fuel. This is not correct, but in fact, they house the workings of the inboard and outboard flaps. Within these structures, the jackscrew, carriages, gearboxes, and associated mounting bracketry are very un-aerodynamic. Therefore, the canoe-like fairings cover them.
Boeing and Airbus aircraft use similar flap fairings, while McDonnell Douglas aircraft in particular have unique vertical fairings that house the hydraulic actuators.
Some flap track fairings have flashy tips, which are for preventing accidents during ground handling operations, e.g. by belt loaders. They can be painted or applied with adhesive tape (possibly reflective, useful at night).
Not all aircraft have these structures under their wings, as the design of the flap mechanism varies according to the manufacturer. But on most Boeing, Airbus, and McDonnell Douglas aircraft that do have these structures, the principle is the same—to provide an aerodynamic cover which in turn reduces drag.