The Prophet was given choice to marry whoever he wanted, proven by:
ترجي من تشاء منهن وتؤوي إليك من تشاء (You, [O Muhammad], may put aside whom you will of them or take to yourself whom you will) - Qur'an 33:51.
(Though, for the most part... he didn't marry the women who offered themselves to him, instead marrying those women off to other good/suitable men. This includes both beautiful and average women).
However, there were times that Allah (ﷻ) governed his actions, proven by:
لا يحل لك النساء من بعد ولا أن تبدل بهن من أزواج ولو أعجبك حسنهن إلا ما ملكت يمينك وكان الله على كل شيء رقيبا (Not lawful to you, [O Muhammad], are [any additional] women after [this], nor [is it] for you to exchange them for [other] wives, even if their beauty were to please you) - Qur'an 33:52.
As we learn from this verse, he couldn't marry any more women upon this revelation, even if the woman was a beautiful one that was pleasing to him. [This was later abrogated according to some scholars, but it shows the limitations Allah (ﷻ) would place on him at times].
Specifically regarding his marriages:
[Choice]: What we see from some of his marriages specifically is that often people would suggest that he marry so and so, and he would consider it and then marry them by choice. They suggested he marry Sauda to bring him some ease and take care of his children; he proposed. They suggested he take Saffiyah into his care because of her high status among her people, making her unsuitable for just any common man; he took her under his authority (as a captive) and then later freed and proposed. Both examples of him marrying by choice.
[Divine Inspiration]: Other marriages were inspired by Allah (ﷻ) as revealed in the Qur'an/Sunnah. Regarding Zaynab, Allah (ﷻ) said, "We married her to you in order that there not be upon the believers any discomfort..." (Qur'an 33:37).
His marriage to Aisha was divinely shown to him via dream. Aisha narrated: Allah's Messenger (ﷺ) said (to me), "You have been shown to me twice in (my) dreams. A man was carrying you in a silken cloth and said to me, 'This is your wife.' I uncovered it; and behold, it was you. I said to myself, 'If this dream is from Allah, He will cause it to come true'" - Bukhari 5078. Turned out, it was from Allah and He caused it to come true.
So the answer is... both :)
But "beauty" was never really a reason he married them. Their beauty was just icing on the cake. All of his marriages were for stronger and good reasons.