We have escaped the galactic government, and now our greatest endeavour yet, life in space. How will these gargantuan space entities eat and survive in space?
Since the feasibility of space whales is not into question, then why not consider the possibility of the existence of space plankton?
Space plankton could feed out of the energy sources mentioned by a4android and L.Dutch answer (and, in the case of phytoplankton, from photosynthesis using the light of a nearby star) and then the whales would feed out of space plankton space clouds.
Since microrganisms are known for having the ability to survive in extreme environments and are even theorized to travel in space, where they "seed" planets with life... it is much more plausible to have plankton to adapt to a form of metabolism that converts space matter and light into energy than a heterotrophic giant animal like a space whale to do it (no matter the level of implausibility you deem acceptable).
The most likely food source for space whales will be giant molecular clouds.
A vast assemblage of molecular gas with a mass of approximately 103 to 107 times the mass of the Sun is called a giant molecular cloud (GMC). GMCs are around 15 to 600 light-years in diameter (5 to 200 parsecs). Whereas the average density in the solar vicinity is one particle per cubic centimetre, the average density of a GMC is a hundred to a thousand times as great. Although the Sun is much more dense than a GMC, the volume of a GMC is so great that it contains much more mass than the Sun. The substructure of a GMC is a complex pattern of filaments, sheets, bubbles, and irregular clumps.
The densest parts of the filaments and clumps are called "molecular cores", while the densest molecular cores are called "dense molecular cores" and have densities in excess of 104 to 106 particles per cubic centimeter. Observationally, typical molecular cores are traced with CO and dense molecular cores are traced with ammonia. The concentration of dust within molecular cores is normally sufficient to block light from background stars so that they appear in silhouette as dark nebulae.
GMCs are so large that "local" ones can cover a significant fraction of a constellation; thus they are often referred to by the name of that constellation, e.g. the Orion Molecular Cloud (OMC) or the Taurus Molecular Cloud (TMC). These local GMCs are arrayed in a ring in the neighborhood of the Sun coinciding with the Gould Belt. The most massive collection of molecular clouds in the galaxy forms an asymmetrical ring about the galactic center at a radius of 120 parsecs; the largest component of this ring is the Sagittarius B2 complex. The Sagittarius region is chemically rich and is often used as an exemplar by astronomers searching for new molecules in interstellar space.
Assuming space whales feed by scooping up matter and then ingesting it and while this is similar to the feeding mechanism of, for example, baleen whales the actual mechanism will be different. baleen whales are filter feeders sifting out plankton from seawater. Space whales would have ingest sufficiently large amounts of matter to secure sufficient mass of organic molecules to feed themselves. This could involve space whales moving at FTL velocities through the volume of molecular clouds. There would need to be a capture structure or field to "scoop up" matter and simultaneously translate it to the necessary state for it to be also moving at an FTL velocity. basically, to bring the matter to being at rest with respect to space whale's motion.
Because space whales are feeding at the level of basic molecules their metabolism will be more like that of a chemical factory than a conventional biological entity. However, basic molecules can be built up into proteins, lipids and glycerides and other organic material. But who said living in space was easy?
Space is full of energetic things (radiation, ions and other particles), and life needs energy. Your swhales (space whales) have various possibilities:
- Energetic radiation harvesting. Gamma rays, X rays, UV rays... plenty of them in the space when close to a star. The swhales may have an organ whose molecules are excited by absorbing these radiation and then release the excitation energy in a biologically usable way.
- Ions harvesting. Stellar winds are also powerful close to the stars. Kinetic energy and chemical energy can be harvested and used for biological purposes, too.
- Mass swallowing. This applies only if your swhales are waaaay bigger than a whale. It goes as it says: they swallow a planet or a chunk of a planet and they digest it.
All the above of course imply that some regions in space will be food rich, while others will be food harm. But that is not different from what whales experience in the Oceans, where plankton is abundant only in certain regions.