Why am I feeling funky?
Solution 1:
It appears that you have been "Mushroomized".
Mushroomization is a status condition caused by mushroom enemies such as the Ramblin' Evil Mushroom. In the overworld, the mushrooms cause the controls to scramble positions while walking around and it also makes a mushroom appear on the head of whoever is inflicted. While in-battle, it may cause a character to attack a party member or heal an enemy. If the prompt "[character name] is feeling funky!" appears after you select your move, the effects will take place.
Emphasis mine.
In other words: "Feeling funky" is the EarthBound equivalent to "being confused" in many other RPGs.
Solution 2:
This is a status condition called Mushroomized that comes from mushroom type enemies. It's very similar to "confusion" in most other games where it can cause the infected player to unwantedly attack allies.
You should be able to remove the effect by visiting the hospital. IIRC there is a man in the lobby that you can talk to who will remove the effect.
Here's a quick run down of mushroomized and its effects.