I bent my foot sideways and now it's swollen and hurts and I can't walk?

Probably sprained it. Get an air cast. It takes time but it will heal. And be more careful in the future!
Maybe a tear? This could represent a torn tendon or ligament in the ankle, which could cause this pain and limitation and swelling. If this has persisted beyond a couple of weeks, you should have an MRI scan to see what truly is going on. But don't wait more than two weeks to get this MRI done.