It is absolutely due to them being housed together, you are the second post of this nature I've commented on today, the other two were together for 4 years, and as soon as the OP separated them the smaller, sick beardie started becoming more active and eating almost immediately, that's how stressed your beardie is and has been it's entire life. They don't lie on top of each other out of love, they certainly don't relax while doing it. Only humans think things like this, the truth is that they are solitary animals and in the wild they live completely alone and never come together except to mate.
Any time someone has 2 bearded dragons housed together, no matter if they've been together without any violence for a week or 5 years, and one dragon is thriving while the other is smaller and sickly, lethargic, and loses their appetite, it's because the larger dragon has been dominating the smaller one in every way. It makes no difference if they both have their own
UVB light or basking light, they absolutely cannot be housed together! And if you already have 2 UVB lights and 2 basking lights then you're ready to separate them immediately!
You need to find a plastic tub about a 50L or larger to use as a temporary enclosure for the bigger, healthy dragon until you can buy him his own permanent enclosure. MOVE THE BIGGER, HEALTHY, DOMINATE BEARDIE OUT OF THE ENCLOSURE THEY'VE BEEN IN, NOT THE SMALLER, SICK, SUBMISSIVE BEARDIE! The sick dragon has been totally stressed out and cannot deal with relocation stress right now, the larger dominate beardie can, and he can go a week or so without any UVB too. You need to put a basking light over the temporary plastic tub so he has heat until you get the second enclosure set up. And they must be either in different rooms or the enclosures need to be stacked on top of each other so that they can't see each other again, nor can they be outside of their enclosures together, not even supervised, because they are at the point where the dominant beardie is going to start attacking the other one. It takes only one good bite to the head and that's it, your Trans Hypo beardie will be dead. This happens all the time, at least a couple posts a week, and as soon as they are separated the poor little stressed out beardie starts thriving...
Please take our advice, this isn't a choice if you don't want your beardie to either become so stressed that he actually starves to death, or your larger, dominate beardie finally decides it's time to take a bite out of him, and then you have a dead dragon or a permanently disabled dragon. Immediately get the larger dragon out of that enclosure right now, don't wait around any longer.
You'll see marked improvement in your beardie within a day or so of separating them, barring that your lighting is adequate and proper, and your temperatures are correct. And if you still doubt that this is his issue, the key is that they both live in the same tank and one is thriving and growing while the other is stunted and sickly. If it was a bacterial infection, a fungal infection, parasites or worms, Adenovirus, etc. they would both be sick. And since they both have the same lighting and temps, and the same diet and supplements, there's no other reason for one to be growing normally and one to be stunted and smaller.