Let E be a contractible space, and $X = E \coprod \{0\}$. Then there is a homotopy equivalence from $X$ to $\mathbb{Z}/2$ sending all of $E$ to $1$ and $0$ to $0$. The monoid structure on $\mathbb{Z}/2$ lifts to an $A_\infty$ structure on $X$.
Suppose we could make this come from a topological monoid structure. By checking the induced monoid structure on $\pi_0$, we find that the unit for the monoid structure would have to be in the component of $0$, and hence would have to be equal to $0$. Then for any elements $e$ and $f$ in $E$, their product $ef$ is in the component of $0$ (and hence is $0$). Thus: any two elements in $E$ are both left and right inverse to each other. By the standard uniqueness trick for left-right inverses, this can only happen in the case where $E$ is a singleton.
EDIT: As Benjamin Steinberg points out, this doesn't really answer the question posed because it assumes that we're fixing a homotopy equivalence to some monoid. I don't, at this point, have a better version, but here's an argument based on something that Tom Goodwillie had posted in the comments.
Suppose $X$ is disconnected, and can be written as a disjoint union of nonempty open sets $U$ and $V$ where $U$ admits the structure of a topological monoid. Then we can define a topological monoid structure on $X$, extending that on $U$, by picking a point $* \in V$ and defining $uv = vu = v$ if $u \in U, v \in V$, and $v v' = *$ for all $v,v' \in V$. So if we're looking for an example which is, say, locally path-connected, we might as well look for a path-connected example, because if any path component of $X$ admits a topological monoid structure we can extend it to all of $X$. (I've played a little fast and loose with identifying this as a monoid structure, but I think it is correct.)