Wind patterns, the Coriolis effect from Earth's rotation, and lunar gravity (driving tides) are the main forces behind ocean currents.
Surface currents are initiated by wind, with Earth's rotation deflecting them. Tidal currents, particularly prominent near coastlines, are caused by the moon's gravitational influence.
Consequently, ocean currents result from the interplay of these combined factors.