Chakotay was a former StarFleet officer before defecting to the Maquis, and became enough of a person of interest to StarFleet that they decided to send Tuvok to infiltrate his Maquis cell and spy on him. Therefore they had more than enough material to recreate his holographic likeness.
As for the knowledge of holographic characters, that seems to depend on the setting, as shown on several episodes. Sometimes the characters will be precisely programmed and won't vary in their ways and knowledge, to respect a specific setting, sometimes the computer makes them adapt and evolve.
In Fair Haven (VOY S06E11) we learn that the basic program for holodeck characters involved a routine that makes them ignore any event that does not fit within the setting, such as the exit arch appearing in the streets of the village.
Of course, this programming isn't foolproof as shown in several episodes: the inhabitants of Fair Haven begin to notice things as the program deteriorates because it had been running continuously for too long, or an holographic Moriarty becomes aware of the real world when the computer is asked to make him an enemy worthy of Data in Elementary, Dear Data (TNG S02E03).
The computer can also apparently extrapolate personality and informations based on very little. In Booby Trap (TNG S03E06), the computer is able to recreate Doctor Leah Brahms' personality with a small margin of error given the information used:
LAFORGE: Yes! All right! Computer, do you have any, you know, personality on file for Doctor Brahms?
COMPUTER: Starfleet personality profile analysis, stardate 40056.
LAFORGE: Did she ever debate at the intergalactic caucuses on Chaya Seven?
COMPUTER: Doctor Brahms attended Chaya Seven caucuses on the following stardates
LAFORGE: Never mind the dates. Computer, if you add data from all these sources, could you synthesise a true representation of Doctor Brahms?
COMPUTER: There would be a nine point three seven percent margin of error in the interactive responses from the facsimile.
LAFORGE: I can live with that. Do it. (Leah takes a breath, then smiles) Doctor Brahms?
LEAH: Geordi, it's me, Leah. Don't start calling me Doctor Brahms or I'll call you Commander La Forge.
LAFORGE: Right.
LEAH: Now, we've managed to maintain energy but we can't leave it in this realignment forever without burning out components, so we need to move quickly.
(Geordi's jaw is on the floor)
Later on, in Galaxy's Child (TNG S04E16), Geordi meets the real Leah Brahms. Throughout the episode, he drops hints and remarks that shows that he learned quite a lot about her from the hologram: like the fact that she likes fungilis and loves to write. Whether that was in the personality profile analysis or taken from another source is never said.
In Concerning Flight (VOY S04E11), we can see that the holographic recreation of Leonardo Da Vinci interprets everything to fit with his views as a character of Earth's 16th century:
(Rumble!)
DA VINCI: Terremoto!
JANEWAY: Janeway to the bridge.
CHAKOTAY [OC]: We're under attack, Captain.
JANEWAY: I'm on my way.
DA VINCI: Earthquakes and idiots. Florence be damned.
Later on an alien planet, after his program has been stolen and somehow uploaded on the Doctor's mobile emitter:
DA VINCI: Catarina! Che meraviglia! Out of my way, out of my way! Scusi, scusi. Catarina. Catarina. Welcome. Welcome to America.
(da Vinci is wearing the mobile emitter.)
DA VINCI: Tell me, Catarina, what do you think of the New World?
JANEWAY: How did you get here?
DA VINCI: A question I have asked myself many times. One moment I was packing for my journey to France, the next I was in this land of marvels. Possibly, upon leaving my workshop I was accosted by Spanish sailors, rendered unconscious, delivered to a galleon in the port of Genoa, and carried like a sack of grain across the vast Atlantic. Curious ears.
JANEWAY: My travelling companion, Tuvok.
DA VINCI: Ah, what the old philosophers say is true. Monstrous and wonderful are the peoples of undiscovered lands. But tell me, Catarina, how did you come to the Americas?
JANEWAY: Oh, it's a long story. A Portuguese ship, some Turkish pirates, a couple of hurricanes. I'll tell you about it some other time.
DA VINCI: Excuse me. There is the man I have been looking for. He has an apparatus that I need for my next invention. My patron is a demanding taskmaster.
JANEWAY: Your patron?
DA VINCI: The prince of this city. Buon giorno, signore.
TUVOK: The Da Vinci character is interpreting this world through the limited capacity of his holodeck programme.
JANEWAY: He sees everything in sixteenth century terms.
TUVOK: But what is he doing here?
JANEWAY: I was running the Da Vinci simulation when we were attacked. His programme must have been active in the computer's memory when the processor was beamed off the ship.
TUVOK: And then downloaded into the Doctor's mobile emitter. But by whom?
JANEWAY: His patron, the Prince?
(da Vinci returns with the item.)
DA VINCI: Marvellous, no?
TUVOK: A plasma injector conduit, Starfleet issue.
DA VINCI: Call it what you will. With this machine I can make mercury flow in three directions at once. You must see my new workshop. The Prince has been very supportive. Andiamo!
As for the holographic Chakotay in Human Error (VOY S07E17), since the whole thing has been programmed by Seven of Nine, it is possible that she gave him all the informations about her, to make the simulation look more realistic.
To sum up, the holographic characters seems to be able to update themselves without external help, and the holodeck computers seem to be able to infer a great many things from partial informations. How the information is interpreted seem to depend on the base programming, though even that can be circumvented in some ways.