Can it be the bearing? and if so can I buy online and take it to a local mechanic to replace it?
Yes, it could be.
Or, it could be a CV joint.
Then again, since you have not described the noise or told us under what conditions you hear the noise, it could be other things also.
If you buy a wheel bearing online and it turns out that someone’s cyber diagnosis was wrong, can you return the bearing? Why not just have your mechanic diagnose the problem?
There are lots of things that can make a noise in that location. A wheel bearing is just one possibility. Is the noise coming from under the hood or under the car? What does the noise sound like? Does it change with engine or vehicle speed?
Mechanics don’t usually take kindly to customers providing their own parts. I suggest you have a mechanic look at the car and diagnose the problem. Then you can figure out how you want to deal with it.