This is a very similar question to another I answered a few months ago, so apologies if you've read that and are looking for a different reply!
I think that there are some paintings that are good paintings at least in part because they are beautiful. Being beautiful is one way in which a painting can be good; beauty is one kind of aesthetic good. But there are others, such as being thought-provoking or communicating deep emotion. So being beautiful is not necessary for being good as a painting. And there may be cases in which a beautiful painting is not good. Some beautiful works of art can be relatively superficial, e.g. they may express a superficial emotion (‘isn’t it lovely?’) or view of life, leaving us wondering dissatisfied with it as art, even if we admire the way it looks on the surface. So beauty is not be sufficient for being a good painting.
But we cannot infer from these points that when a painting is beautiful and good, its being beautiful is not what makes it good. In other words, there may be cases in which the beauty of the painting is what makes it good (or at least, is one reason why it is good). To appreciate this, we have to resist the thought that there must be universal rules that we apply in judging whether something is aesthetically good or not. Beauty might be sufficient on one occasion but not on another.
Perhaps an analogy with causes is helpful. Striking a match is neither necessary nor sufficient for lighting a match. I can light a match without striking it by placing its end in an existing flame. And I can strike a match without lighting it by doing so in an environment without oxygen (e.g. on the moon). But I still want to say that, under normal conditions, my striking the match causes the match to light. So if a good painting is beautiful, it may be that it is good because it is beautiful, though it may be that it is good because it is, in addition, deeply expressive or thought-provoking or.... Cases could differ.
I don't think we can say that a painting (beautiful or not) is good because it is good - the 'because' is misleading here. You might want to say that 'good' has no further definition (as Moore did about moral goodness), i.e. you can't define 'good painting' as 'beautiful painting'. This is a claim about the concept 'good'. Even if we accept this, we can allow that there are properties that make a good painting good - this is about the relation between the property of being good and other properties. Just as Moore thought that what makes a good action good is that it maximises happiness, so we can argue that makes a good painting good is its beauty, or perhaps a multiplicity of different aesthetic qualities. Or, put differently, we could think that a painting's being beautiful is a reason to think that it is good, without saying that being beautiful is the same thing as being good (as a painting).