One big similarity between the two novels is that both follow protagonists who seek to fulfill their desire for another: Gatsby pursues Daisy throughout the novel, while Hester’s consummation of her passion for Arthur (and its covert continuation throughout the novel) put all events in motion in The Scarlet Letter. In a broad way, we can understand both as novels of unfulfilled desire, both set in the context of very different Americas.
In The Scarlett Letter, both sex with a minister (Arthur) and sex outside of marriage is forbidden. Arthur and Hester transgress those boundaries secretly, but must spend the rest of the novel apart in order to hide their transgression. Similarly, Daisy and Gatsby’s relationship is forbidden by the social stigmas of the time: Daisy, as a wealthy member of the upper class, would not be allowed to marry Gatsby, a poor blue-collar worker. But like Hester and Arthur, they have a brief affair before the action of the novel, which is never resumed.
In sum, both The Scarlett Letter and The Great Gatsby chronicle the stories of star-crossed lovers who may never consummate their mutual passion due to societal constraints.