Why do I feel a shocking sensation in my chest? Its as if my heart, lungs, and stomach are contracting for 3 seconds and then relaxing. It still hurts

Could be a number of. Things, but without more information or a physical exam, my best advice would be to see a physician as soon as possible. It may be a muscle spasm, such as a diaphragm spasm, or gastric issues, but anything that causes shocking chest pain needs to be checked out as soon as possible. I am sorry i cannot be more helpful, but i just want you to do the safest thing for you.