The primary-versus-secondary line is about who is on the other side of the trade. When a company issues new shares in an initial public offering, or a government auctions new bonds, the buyer's money goes to the issuer, and that is a primary-market transaction. Every trade after that, an investor selling those same shares to another investor, is secondary-market activity. The security is not new, the issuer is not a party, and no new capital is raised. The overwhelming majority of daily trading volume is secondary; primary issuance is comparatively rare for any given security.
Exchanges and over-the-counter networks are both secondary markets. A stock exchange is an organized secondary market where listed securities trade through a central, regulated venue. The over-the-counter market is a decentralized secondary market where securities trade directly through dealer networks rather than on an exchange, which is common for many bonds and for smaller or unlisted stocks. Both are places where existing securities change hands between investors; they differ in how the trades are organized and how much public information and regulation surrounds them.
Secondary-market liquidity is what makes primary issuance work. An investor will pay for a newly issued security partly because they know they can sell it later without having to find the issuer or wait for it to mature. That confidence, that a deep and continuous market of other buyers will exist, is what lets companies and governments raise money on reasonable terms in the first place. A security with no secondary market, one that cannot be resold, would have to offer a much better price to compensate for being stuck with it. So the two markets are not separate worlds; the secondary market is the precondition that makes the primary market function.
The price you get is set by other investors, not by the issuer. Because a secondary-market price reflects what buyers and sellers agree on at a moment, it moves with supply, demand, and information, and it can sit far from the price at which the security was first issued. This is ordinary and expected: a stock that went public at one price trades on the secondary market at whatever investors will pay for it thereafter, which is the entire reason a share price changes from day to day.