In general Hyper beam is better. It has more dps and with the added STAB the difference is even bigger.
In certain matchups however, Earthquake can be a great move, as it destroys Fire and Electric pokemon for example. But also in matches vs Rhydon and Golem, Hyper Beam will not be very effective, while Earthquake even deals extra damage due to their Rock type.
But in general, it's Hyper beam ;)