The original energy that caused the rotation of the earthEarth when it was formed came from the gravitational collapse of the cloud of dust and gas that formed the solar system. Maintaining rotation at constant speed in a vacuum does not require any further input of energy. Conservation of angular momentum keeps the earthEarth rotating.
In fact, over long time scales (millions of years) the earth’sEarth’s rotation does slow down gradually due to energy lost in friction and tidal forces.