So, I was using Eorland Gray-Manes forge without causing any harm and all of a sudden I see loads of red dots on my map and it was the Companions and then even Eorland started attacking me. The Guards didn't do anything but cheered: "A Fight!" I even saw Vignar Gray-Mane attack me too. I have a bounty but it wasn't in Whiterun.
In general, most factions will not be hostile towards their own members. Adding yourself to the offending faction is often a solution to this kind of problem (e.g. Missing In Action, I've personally experienced that bug). The Companions have a faction ID of
00048362, so running this command should stop them attacking:
player.addtofaction 48362 0
This may break the quest Take Up Arms, and possibly the entire Companions questline with it. You should be able to resolve this by using
setstage C00 <stage number> to partially or entirely skip the quest. It may be safer to skip one stage at a time instead of trying to skip the whole quest at once. It's also possible the quest will "just work" (or that it will work once you've advanced it to stage 10), so you should try to complete it normally first.
This does leave you a member of the Companions, which you may not have wanted, but you are not obligated to continue the questline, and membership in the Companions is rather useful in the early game, IMO. At a minimum, it gives you some free items, a place to sleep, and an endless supply of simple radiant quests.
I think my experience with the companions attacking me was more deliberate on the games part. See I was walking around the country side near markarth ( the reach I think it's called) after completing the mission where you break yourself out of silver blood mine with the foresworn. I had collected a rather large bounty in markarth killing guards and such so out of nowhere farkus, the dark elf, (forgot his name)and Trevor came charging at me already hostile. I defended myself, but after that I had to avoid all contact with the companions even though I had no prior contact with them before the attack. So maybe it has something to do with excessive bounty?
I was returning from a side quest Vilkas had given me and before I could approach him Ria and Najda Stonearm drew their swords and attacked me. My follower, Alea, and a couple guards stood back and watched. The Jarl came to my defense and soon went to his knee to yield. That's when I ended the attack by killing both Najda and Ria. There was no further aggression even though I was sure Alea would retaliate. I'm playing esV on a ps3. I'm going back to a previous save to see if it happens again. In my opinion this problem is a random glitch that won't occur again.
(I loaded a previous quest save then went back to Vilkas and asked for work again. After completing that quest I went back to Vilkas but didn't get attacked. So I can say my idea worked.)