Echolalia is kind of similar to a tic (in some cases, people with tic disorders like tourettes get echolalic tics), but there is some level of control yes. Depends how severe it is. With autism, echolalia is more of a stimming thing, but unfortunately as a non autist I have no idea what feelings stimming relieves or produces.
It's a sensory thing, as autistic people are usually either sensory seeking (they need more sensory input than normal, so their actions are to try and get that missing sensory stimuli) or sensory sensitive (they become overly stimulated easily with minimal input in comparison to most people). Echolalia is more of a sensory seeking behaviour, going by those definitions, but it could also be some kind of sensory regulation if someone is overstimulated.
My experience with it is a bit limited though, as most of the time I've seen echolalia it's in nonverbal autism, and echolalia is one of the few ways a person is able to communicate. Sometimes it will just be a flurry of random words they have heard, but it's got a meaning to them in that they associate it with the thing they want. Maybe a child at school wants to watch TV, so they say "TV at home??" Because they have been told they can't watch TV at school, TV is at home. They can't say "I want to watch TV", so they just repeat the thing they've heard the most. Some people with echolalia want you to also repeat back to them what they have said, as a kind of confirmation you've understood or just because they like the sound of whatever they're saying (more sensory than communication there). This is why you will get nonverbal autistic people who can only say a few words if anything, they're actually just repeating words because they can't really produce their own language.