You can do absolutely anything to things you own, including cars. That's kinda the point of ownership. Cut it in half if you want. Smash it to pieces. It's all good.
I guess what you're really referring to is whether it's still legal to drive on the public highway. As far as I know you can still do anything as long as it still passes the MOT test for roadworthiness. People do engine swaps. You do have to consider insurance, though, which is also a legal requirement for use on the public highway. General insurers typically won't insure modified cars, but there are specialist insurers that will.
As I understand the US is far more lax in its vehicle testing than other places, but this isn't really related to ownership and being able to modify things you own.
>General insurers typically won't insure modified cars, but there are specialist insurers that will.
It's illegal to drive without insurance. This effectively means that engine swaps are illegal, unless you are rich enough to afford some special insurance
In a lot of places that is highly illegal