Are you charging it correctly? To charge the controller, you use the PS3 charge cable that should have come with the controller (it's a USB A to mini B cable). Plug the USB A end into any port on the PS3 console and plug the mini-USB B side into the PS3 controller. The controller will only charge if the console is on.
Are the USB slots on the PS3 busted? Try a different slot on the PS3 console, or try a known working controller/cable combination on the slot in question. Alternatively, you can use something that has a USB port on it to charge your controller (for example, a laptop or PC). Again you must make sure the device that is charging the controller is on.
If the problem was the PS3, you can send it in for repair
(if under warranty, it's free; otherwise it's 150$ so it might be better to just deal with the broken USB port).
Maybe the cable is broken? Try another cable, if possible, with a USB slot and controller you know is working. If it is the cable you can get replacements for really cheap
If you can confirm that it's none of the above, the problem is probably with the controller. The first thing you should try is resetting the controller. There's a small button on the back of the controller, near the L2 button. You'll need a paper clip, but just press that. Then try to use it/recharge it again.
If it still won't charge it's possible the controller is dead (as in the battery will no longer hold a charge). The best way to confirm this is to try and use your controller while it's plugged in (as if to charge it); if it works while plugged in, but stops when you unplug it then the battery has died. You can replace the battery yourself
(there are instructions in the PS3 manual), or send in the controller to Sony for a replacement
(assuming it's a first-party controller aka made by Sony). If you're under warranty it's free (first party peripherals are covered), otherwise they may still take it for a fee but I'm not sure.
Hope you're able to fix the problem!