BP’s strong recovery, which followed a large loss in 2020, came as the London-based company said it plans to boost its spending on low-carbon and renewable energy.