DC converters for solar cell
In most cases, in order to charge a battery, we need to control the input voltage/current and achieve the maximum power point (via a MPPT method).

Next figure shows a simplified model.


source: https://outbackjoe.com/macho-divertissement/macho-articles/design-guide-for-12v-systems-dual-batteries-solar-panels-and-inverters/

There are plenty of textbooks and sites that explains how DC/DC converters work and how to utilize them in a battery charging system.

For example, a Boost Converter (Step-up DC/DC Converter) increases the output voltage of a solar panel and tries to find the point where the power transfer from the panel to the battery becomes maximum (MPPT).

Charging a battery from a wall outlet is also possible - of course by using a proper AC/DC converter - but then you are using the energy that comes from the grid (eg. coal) and not a renewable source, like the sun.