There is difference of opinion on this, the following interpretations have been related:
It means the rulers ( أمراء ) who are appointed over people. This is because the previous verse instructs them:
إن الله يأمركم أن تؤدوا الأمانات إلى أهلها وإذا حكمتم بين الناس أن تحكموا بالعدل
Indeed, Allah commands you to render trusts to whom they are due and when you judge between people to judge with justice.
— Quran 4:58
And then 4:59 instructs the subjects to obey them when they render their duties.
This is also supported by the following narration:
عن ابن عباس رضي الله عنهما أطيعوا الله وأطيعوا الرسول وأولي الأمر منكم قال نزلت في عبد الله بن حذافة بن قيس بن عدي إذ بعثه النبي صلى الله عليه وسلم في سرية
Narrated Ibn `Abbas:
The Verse: "Obey Allah and Obey the Apostle and those of you (Muslims) who are in authority." (4.59) was revealed in connection with Abdullah bin Hudhafa bin Qais bin Adi' when the Prophet (ﷺ) appointed him as the commander of a Sariyya (army detachment).
— Bukhari and Muslim ; some have linked to this hadith
Tabari has narrated similar from Abu Hurairah:
عن أبي هريرة في قوله: " أطيعوا الله وأطيعوا الرسول وأولي الأمر منكم "، قال: هم الأمراء.
And has also narrated an alternate event where a disagreement arose between Ammar bin Yasir and Khalid bin Walid, where Khalid bin Walid had been appointed the amir and then 4:59 was revealed
Qurtubi and Baghaway have related a tradition from Ali:
وقال علي بن أبي طالب رضي الله عنه : حق على الإمام أن يحكم بما أنزل الله ويؤدي الأمانة فإذا فعل ذلك فحق على الرعية أن يسمعوا ويطيعوا
Ali Ibn Abi Talib said: The duty of the Imam is that to judge according to Allah's revelation and to render trusts. When he does so it is the duty of the subjects to listed to him and obey him.
It means the Ulema (scholars). This is the view of Mujahid, Ata, Hassan and Abu Alia
It means the companions of the Prophet ﷺ. This is one view related from Mujahid.
It means Abu Bakr and Umar. This is the view of Ikrimah.
Regarding the Shia interpretation that it means the Shia Imams:
Qurtubi and Jassas have mentioned that the rebuttal to their claim is present in the verse itself:
أطيعوا الله وأطيعوا الرسول وأولي الأمر منكم فإن تنازعتم في شيء فردوه إلى الله والرسول
Obey Allah and obey the Messenger and those in authority among you. And if you disagree over anything, refer it to Allah and the Messenger
Whereas if their Imams are meant by أولي الأمر and their Imams are divinely guided and infallible ( معصوم ) then it should have said:
فردوه إلى الإمام وأولي الأمر
(if you disagree ) refer it to the imam , to the Ulel Amr
Because it would be forbidden to disagree with them, it would be impossible for their view to be wrong, and they would be the absolute authority on the interpretation of the Quran and the Sunnah.
Instead the Quran has omitted the أولي الأمر from those to whom matters of disagreement should be referred to.
Jassas has also argued that أولي الأمر are a group while Ali was a single person and that the verse was initially meant for the people in the Prophet's time and Ali was not the Imam during the life of the Prophet.