I arrive CPH from the US via LHR on British Air, Terminal 2, at 17:30. I then depart CPH on a separate itinerary on Adria Air, 20:30, also Terminal 2. I will only have carry-on baggage. Can I go directly to my Adria flight or do I first need to go through customs and re-enter the terminal?
When arriving at CPH, you will follow the "international Transfer" signs Leading you through a security control. Then, because you're continuing on a "domestic" flight (as Denmark and Slovenia are both part of the Schengen Area, which is a single country for border purposes), an Immigration checkpoint will follow.
Then you hop on the flight to Ljubljana, and in Ljubljana, walk through baggage claim to the exit without further ado.
With only carry-on baggage, you will not need to pass through customs in Copenhagen, but (assuming your Adria flight is to Ljubljana, or indeed if it is to any Schengen destination) you will have to pass through immigration controls in Copenhagen, because you will be entering the Schengen area there.
The flight from Copenhagen to Ljubljana is an "internal" Schengen flight, so there are no systematic passport controls. People arriving from abroad must therefore be admitted to the Schengen area before boarding that flight.
If your second flight is somehow to a non-Schengen destination then you will not need to pass through immigration controls.
When you arrive in Ljubljana, you will pass through the customs checkpoint as you leave the secure area of the airport.
For any other readers who may be in a similar situation but with checked bags, it will be necessary to collect the checked bag, pass through customs controls, and then check the bag for the next flight. On arrival in Ljubljana, you will pass through customs again, but your baggage tag will be an "internal" tag indicating that you have arrived from an EU point of departure. The passport control will take place before you reach the baggage claim in Copenhagen.