Yes, both Argentina and Brazil
could produce nuclear weapons, given enough time and effort, but neither one of them has ever had them. Neither does either country currently have plans to produce or acquire nuclear weapons, as far as is publicly known. So they are not examples of countries that gave up nuclear weapons.
A nuclear submarine is also not what is meant by "nuclear weapon", although it is arguably a weapon and has the word "nuclear" in its name. The phrase "nuclear weapon" conventionally refers to "atomic bombs" and "hydrogen bombs", which are bombs powered by respectively fission and fusion. A nuclear submarine is just a regular submarine powered by a nuclear reactor. Brazil already has many nuclear reactors that are in some sense "totally based on Brazilian technology" and has for decades.