Two problems:
First: AssociateTo needs the name of a variable (a1), not the variable
contents (<||>). Similar issues can appear with AppendTo, see the
first Possible Issues example on its documentation page. AssociateTo
has HoldFirst, so it itself is not evaluating a1, but it appears
such an evaluation is happening along the way while passing the
argument into your extend function. One way of addressing that
problem, where each line needs to get evaluated separately, i.e. in
its own cell:
Clear[extend];
a1 = <||>;
extend[] := Module[{}, AssociateTo[a1, x -> RandomInteger[{1, 10}]]];
Do[extend[], {3}]
Second: You are associating the same key 'x' with a different value in each iteration, so all previous values get overwritten each time.You will either have to create different keys in each step, or try to Merge them (the latter, of course, could more easily be achieved by first creating the list of values, and creating an Association from it with the single key only in the last moment).
Hope this helps,
Peter