The characters combine to create a powerful image: “To chase the flame and cling to the power.” This idiom literally illustrates the act of running towards those in power to attach oneself to them for personal gain.
This idiom, while classical, is very much alive in modern China.
The term is always highly negative and is used as a criticism or insult. You would never describe yourself or someone you respect as 趋炎附势.