Wind and wave energy have substantial potential as renewable sources of electricity. With the development of various power-generating options, wind and wave energy are expected to play a crucial role in electricity generation. However, the irregularity and strong nonlinearity of wind and wave energy make accurate prediction necessary for the stable operation of power plants and electricity and energy trading. Here, we used deep-learning methods to predict wind and wave energy, compared the prediction results of eight neural networks—long short-term memory (LSTM), gated recurrent unit (GRU), and bidirectional long short-term memory (BiLSTM)—and used four error metrics for model evaluation. We also proposed an attention mechanism to improve the prediction accuracy of these neural networks by focusing on more important information, obtaining weights at different scales, and suppressing noise signals, thus improving the performance of the model, which was evaluated using the Yellow Sea observation dataset. The results show that the proposed AT-BiLSTM outperforms other models in that for wind and wave energy it has a mean absolute error of 11.25 W/m2 and 0.1 kW/m, mean absolute error percentage of 0.102 and 0.035, root mean square error of 22.947 W/m2 and 0.3 kW/m, and correlation coefficient of 0.931 and 0.982, respectively.