Boxing has a very high, very tight guard which is practically in touch with one's own jaw bones. That makes sense, since the gloves only have to protect the head in infights. Few boxers catch punches and most of the defensive work in distance is done by footwork and upper body movement. Those who do catch punches also have a guard which is more open.
In Muay Thai, on the other hand, your defense has to be more versatile: you need to be able to parry punches and kicks as well as be able to grab and clinch. If you look at all that, an overly tight and close guard would be detrimental since you'd need to do additional movements for that which make you slower.
This can actually be demonstrated by using the the first picture: Since it is almost impossible to foretell whether a roundhouse kick is going to land high or low, Muay Thai fighters close knee and elbow to close upper and lower block and leave no opening on the side. Turning the hands in, and with them the elbows, would mean you have to turn out first for that block. Again, this makes the whole thing slower. Boxers don't have to worry about their lower body or kicks hence they can tightly guard their upper body only.
Another aspect has been mentioned by @Frutilitarian in comments: A tight guard can be locked in a clinch so that you cannot get your arms out anymore. That would be disastrous as you have no means to break the clinch or mitigate impact from the opponent's knees.
Overall, it is safe to say that the Muay Thai guard is a perfect compromise for being able to block and parry punches and kicks to anywhere on the body as well as going into clinch all at once. The classic boxing guard is all about mitigating unexpected hits by punches on upper body and head only, protecting the worst spots for being hit there (head, liver, floating ribs, sternum) as a priority. Generally, the more versatile your guard has to be due to different distances and defences, the further away and more open your hands will be. The main reason for Muay Thai having the gloves close to the head is when they use boxing gloves with which you can mitigate a lot of damage when having contact to the head as opposed to thinner mma or no gloves which demands and allows for more parry/catching and grappling.