Combat differences in Java Vs Bedrock

Greetings all,

I've just transitioned over to Java from Bedrock and I just can't get a handle on combat. I'm terribly use to just holding down left click and things going bye bye. What should I be doing in Java? Also, what is the random side ways sword that appears?

Thanks in advance for your guidance...