Chinese idiom for "tilt at windmills" or "fighting against windmills"
The closest I can find is 水中捞月 (shuǐ zhōng lāo yuè). From 汉典:


  到水中去捞月亮。比喻去做根本做不到的事情，只能白费力气。


Trying to scoop up the imaginary moon from its reflection in the water. That is, trying to do something in vain or making a futile effort.

If you want to emphasize on the physical effort, 以卵击石 (yǐ luǎn jī shí) might be better:


  拿蛋去碰石头。比喻不估计自己的力量，自取灭亡。


Using an egg to hit the stone. Overestimating one's ability and courting certain "death". The death here usually refers to failure.

I am not sure if you will be able to find an idiom that matches all the characteristics in the English idiom.