"Can I charge a supercapacitor by connecting it directly to the power grid?"
Certainly not. First, the supercapacitor needs continuous voltage. This voltage needs to be rectified. Second, the load voltages are very low. It is necessary to adjust the tension. And, thirdly, what requires more care is that a discharged supercapacitor practically represents a short circuit requiring very high currents that can cause the components used in the charger to burn. The circuit must be designed to limit the maximum load current.