Say I live in country A and work from home for a company which resides in country B. Both A and B are members of EU. Where do I pay my income tax?
Short answer: This is a very fact specific question and we don't know enough to know, given what the question states.
Generally speaking, EU member countries don't attempt to tax income earned by their citizens while their citizens are abroad.
But, that principle will often not resolve the question of where the income was earned.
The nature of the work probably matters. If you write a legal brief from your French villa for submission in an German court, you are probably working in Germany. If you dig a ditch in France for a German company or sell French real estate as a realtor for a German company, you are probably working in France. If you write software code for an German company from your French villa, I'm not certain. And, I'm not inclined to dig into the nitty gritty without knowing more facts as there are likely a lot of detailed sub-rules and I'm not inclined to delve into all of them comprehensively.
The details probably depend upon the countries involved since, while the EU has some authority in this area, the laws in question are implemented and enforced at the member state legislation and regulation level and this is an area where fine details of that implementation would matter.
Also, all of this assumes you are paid as an employee for services rendered. If you are yourself a company, or if you own the company you are working for and making money from that company in your capacity as an owner of the company receiving profits rather than as an employee, your income from profits is probably localized wherever the company is organized or has its headquarters, although sometimes bureaucratic rules allocate it on another basis.