Upvote:2
ESTAs and visas are only for entry. ESTA allows you to seek entry into Visa Waiver Program status. (Similarly, a B2 visa allows you to seek entry into B2 status.) Having an ESTA or a visa will not by itself change you into that status while in the US. The only ways to go into a different status are: 1) leave the US and re-enter into that status, or 2) do a Change of Status inside the US.
You cannot do Change of Status into VWP visitor status, but you can do Change of Status into B2 status. Change of Status into B2 is what people commonly do when they need to stay longer in the US after their other nonimmigrant status ends. However, if your J1 has a two-year home residency requirement, you are not allowed to do Change of Status; in that case, leaving the US and re-entering (either as VWP or B2 visitor) would be your only option.
If your J1 doesn't have a two-year home residency requirement, you can do Change of Status to B2 by filing I-539 and pay the $455 fee, and you can stay in the US while the application is pending. You do not need to have a B2 visa to do Change of Status since, again, visas are only for entry. However, it might still be easier or cheaper to leave and re-enter as a VWP or B2 visitor.
As for whether you can apply for an ESTA while you are in the US, I don't think where you are when making the application makes any difference. Of course, you will need to be outside the US before you can use the ESTA, because ESTA is only for entry. But if you wish to save some time by applying for it when you are in the US and then leaving, that's fine.