There is evidence from the Agent Carter TV show that Sharon was not related to Peggy.
We know from the Agent Carter series is that Peggy only had one brother, Michael, who died.* There was never any indication that Michael had children, therefore Peggy couldn't have had a niece, great or not. My theory is that Sharon simply used the coincidence of sharing Peggy's last name to pretend to be the former SHIELD director's relative. Peggy's dementia helped with that deception, preventing her from realizing that Sharon was an imposter (if they ever even met).
Although Sharon Carter represented herself as Peggy's great-niece, at no time did we see the two of them together. Sharon was allegedly talking to Peggy in TWS when she and Steve met in their apartment building, but for all we know that was a ruse on Sharon's part.
Why would Sharon pretend to be Peggy's niece? Well, for one thing, the supposed relationship could have helped her SHIELD career. Being the niece of the legendary Agent Carter would be very impressive to those deciding whether to accept Sharon for training and her own skills would put her over the top. Another possibility is that Sharon was one of the many Captain America 'stans in the MCU, like Phil Coulson and Scott Lang. From her actions in TWS, we saw that she was extremely loyal to Captain America, much like Scott is. When Cap was found in the ice, Sharon could have seen an opportunity to get closer to her idol.
Spies are deceptive by nature. Sharon just used the opportunities that fell into her hands to get what she wanted.