YES, it does NOT require an attack
The relevant part of a Fire Elemental's "Fire Form" ability reads like this:
In addition, the elemental can enter a hostile creature's space and stop there. The first time it enters a creature's space on a turn, that creature takes 5 (1d10) fire damage and catches fire.
Entering the space of another creature is different from stopping there or attacking. The rule specifically states that simply entering the space as part of your movement causes them to take 5 (1d10) fire damage.
This is different from the damage inflicted for touching or attacking the elemental, which would not trigger in this scenario. It's important to distinguish the 2 sources of damage because they function differently (Movement one is only once per turn).
There is no rule about inflicting fire damage specifically by attacking.