OS X works perfectly fine on external HD but extremely slow with HD on MBP Things get weird when I replaced my HDD with an SSD since my MacBook Pro  (Mid-2012) slowed down horribly. I get beachballs everything I did on my MBP and it was so painful.

I thought it was because of malfunctioning HD, so replacing it with an SSD gonna both speed up my system and help me to get rid of old HDD. I installed OS X to my SSD with and external box, run my computer over that and boom! MBP speed-ed up and it seems to worked out. So, I open my MBP, replaced old HDD with my SSD, I rebooted my MBP and it was worse than before. How could this be possible?!

So I decided to do something else. I put my old HDD to USB converter box, connect it to my MBP, run OS over that. MBP works like charm.

I was wrong, there is nothing wrong with my HDD. Does anyone have any idea regarding to this?

Any input is appreciated.
If both the HDD and the SSD are running significantly faster when installed in the external enclosure rather than the internal bay, your SATA cable is likely the culprit. Both should run faster when connected via the internal SATA bus vs external USB 3.0 bus. You can run the Apple Hardware Test (which doesn't test your drive, but does test the connection), but it's prone to false negatives. 

If you are close to an Apple Store, my advice would be to take it in for a free diagnostic (AppleCare won't cover the cost of replacing the cable since you already swapped out the drive, however). At any rate, you can get a definitive diagnosis and then decide whether to go through Apple, use a third-party service, or a DIY solution as posted in the link above. BOL.