https://online.hbs.edu/blog/post/fiduciary-duty-to-investors
They owe a fiduciary duty of loyalty to shareholders - they (named executives) must act in the best interests of shareholders. So that doesn't necessarily mean doing everything possible at all times to maximize profits/share price in the short term, it does mean they need to attempt to do that in the long term while balancing that duty against other duties they owe (like to act lawfuĺly).